hi
Help to solve the problem, Give some concrete examples.
Hi @Vinson
can you please be more specific? Can you explain what is it that you are trying to achieve? What have you tried? What information you couldn’t find? What is not working as expected?
sorry. I mean how use jgroups implement axon CommandHandler cross-machine call. please provide example for me. thanks.
From the scarce piece of information you’ve provided, I assume what you are trying to achieve is the following:
- On machine
M1
you have an applicationA1
which sends a command. - On machine
M2
you have an applicationA2
which should receive and handle that command.
If that is the case you can
- Install and run Axon Server on a machine that is accessible from both
M1
andM2
(here is how) - Configure both applications
A1
andA2
to connect to it (by settingaxon.axonserver.servers=<HOST>:<PORT>
property) - Implement a
CommandHandler
inA2
(here is how) - Send commands that
A2
can handle fromA1
app (here is how)
I hope this helps. If not, please describe the issue you have in more details.
Thank you very much for your answer.
But,The actual scenario is we use extension-JGroups to implement(not use axon-server) :
- On machine
M1
you have an applicationA1
which sends a command. - On machine
M2
you have an applicationA2
which should receive and handle that command.
application A1 IP:10.181.26.8 Port:7800
application.properties:
axon.distributed.enabled=true
axon.distributed.jgroups.bind-addr=10.181.26.8
axon.distributed.jgroups.bind-port=7800
axon.distributed.jgroups.gossip.auto-start=true
axon.distributed.jgroups.gossip.hosts=10.181.26.9[7800]
application A2 IP:10.181.26.9 Port:7800
application.properties
axon.distributed.enabled=true
axon.distributed.jgroups.bind-addr=10.181.26.9
axon.distributed.jgroups.bind-port=7800
axon.distributed.jgroups.gossip.auto-start=true
axon.distributed.jgroups.gossip.hosts=10.181.26.8[7800]
A error is as follows:
2020-11-25 10:00:32.694 [TcpServer.Acceptor[7800]-1,Whh,DESKTOP-42HUNN1-49422] WARN: JGRP000006: failed accepting connection from peer Socket[addr=/10.181.26.9,port=52763,localport=7800]: java.net.SocketException: 10.181.26.9:7800: BaseServer.TcpConnection.readPeerAddress(): cookie sent by /10.181.26.9:52763 does not match own cookie; terminating connection [Slf4jLogImpl.java:115]
How to use extension-JGroups to implement distribute Command invoke. I look forward to your answer, which will be very helpful to me.
I’m not a JGroups expert but one thing you may want to make sure is that nothing else tries to connect to port 7800 on those machines. IIRC that may cause the “cookie sent by … does not match own cookie” error. Perhaps try different ports.
Sadly, this error you are getting @Vinson does not ring a bell in combination with JGroups at all.
What you should know, is that the JGroupsConnector
the JGroups Extension provides is based on the configuration of JGroups itself. Anything about message distribution is implemented by the JGroupsConnector
itself and doesn’t require any configuration from your end.
As it’s thus JGroups specific configuration, I’d highly recommend having a look at the JGroups Documentation to further dive into what you can configure and how that influences your network. As stated by @milendyankov too, from the exception you are receiving it seems to be a network issue however and not so much to do with JGroups or Axon.
Let us know whether the issue still persists. And by the way, in the future, it would be beneficial to provide as much information regarding the problem you are having upfront, instead of later. It simply makes answering your question a lot easier if we know what you actually intend to do.