2

I am trying to use the Multi-Destination-Cast transportation, but I don't know how to configure-it, I am trying to implement the Example URIs explained here using the SimplePublisher.java and the SimpleSubscriber.java

I have one publisher and two subscribers.

Of the default aeron parameters that carry the SimplePublisher.java and SimpleSubscriber.java, I've changed:

From SimplePublisher.java

final String channel = "aeron:udp?control=192.168.0.3:4050|control-mode=manual";

And From SimpleSubscriber.java:

I have duplicated the class SimpleSubcriber1.java and SimpleSubcriber2.java and I have changed the following configuration:

SimpleSubcriber1:

final String channel = "aeron:udp?endpoint=192.168.0.4:4051"

and

SimpleSubcriber2:

final String channel = "aeron:udp?endpoint=192.168.0.5:4052"

The errors that I get for both the publisher and the subcriber are almost identical:

For the Publisher:

Publishing to aeron:udp?control=192.168.0.3:4050|control-mode=manual on stream Id 10
io.aeron.exceptions.ChannelEndpointException: RuntimeException : Channel error: Cannot assign requested address: bind : aeron:udp?control=192.168.0.3:4050|control-mode=manual
at io.aeron.ClientConductor.onChannelEndpointError(ClientConductor.java:196)
at io.aeron.DriverEventsAdapter.onMessage(DriverEventsAdapter.java:77)
at org.agrona.concurrent.broadcast.CopyBroadcastReceiver.receive(CopyBroadcastReceiver.java:100)
at io.aeron.DriverEventsAdapter.receive(DriverEventsAdapter.java:56)
at io.aeron.ClientConductor.service(ClientConductor.java:660)
at io.aeron.ClientConductor.doWork(ClientConductor.java:151)
at org.agrona.concurrent.AgentRunner.doDutyCycle(AgentRunner.java:233)
at org.agrona.concurrent.AgentRunner.run(AgentRunner.java:159)
at java.lang.Thread.run(Thread.java:748)
Failed to connect to subscriber

And, for the subcriber:

Subscribing to aeron:udp?endpoint=192.168.0.4:4051 on stream Id 10
io.aeron.exceptions.ChannelEndpointException: RuntimeException : Channel error: Cannot assign requested address: bind : aeron:udp?endpoint=192.168.0.4:4051
at io.aeron.ClientConductor.onChannelEndpointError(ClientConductor.java:187)
at io.aeron.DriverEventsAdapter.onMessage(DriverEventsAdapter.java:77)
at org.agrona.concurrent.broadcast.CopyBroadcastReceiver.receive(CopyBroadcastReceiver.java:100)
at io.aeron.DriverEventsAdapter.receive(DriverEventsAdapter.java:56)
at io.aeron.ClientConductor.service(ClientConductor.java:660)
at io.aeron.ClientConductor.doWork(ClientConductor.java:151)
at org.agrona.concurrent.AgentRunner.doDutyCycle(AgentRunner.java:233)
at org.agrona.concurrent.AgentRunner.run(AgentRunner.java:159)
at java.lang.Thread.run(Thread.java:748)

If you need, I can give you more details about whatever.

PD: I have the MediaDriver the LowLatencyMediaDriver runing, this is not the problem

Thank you in advance

david.t_92
  • 1,971
  • 1
  • 11
  • 15

1 Answers1

3

Configure as follows:

Publisher:

aeron:udp?control=<publisher-ip>:<publisher-port>|control-mode=dynamic

Subscribers:

aeron:udp?endpoint=<subscriber-ip>:<subscriber-port>|control=<publisher-ip>:<publisher-port>|control-mode=dynamic

The default control mode for a MDC is dynamic (and could be omitted). Each Subscription will register itself over the control channel and will subsequently receive messages on the endpoint specified.

The alternative is to use the 'manual' control mode where Subscriptions are added manually by the Publication using addDestination/removeDestination.

As for the error you received:

Cannot assign requested address: bind : aeron:udp?endpoint=192.168.0.4:4051 at io.aeron.ClientConductor.onChannelEndpointError(ClientConductor.java:187)

It's likely you were receiving that message because there was already something listening on that port or the interface doesn't exist on that host.

James
  • 388
  • 3
  • 7