public interface CommandBusConnector extends MessageHandlerInterceptorSupport<CommandMessage<?>>
Modifier and Type | Method and Description |
---|---|
<C> void |
send(Member destination,
CommandMessage<? extends C> command)
Sends the given
command to the node assigned to handle messages with the given
routingKey . |
<C,R> void |
send(Member destination,
CommandMessage<C> command,
CommandCallback<? super C,R> callback)
Sends the given
command to the node assigned to handle messages with the given
routingKey . |
Registration |
subscribe(String commandName,
MessageHandler<? super CommandMessage<?>> handler)
Subscribes a command message handler for commands with given
commandName . |
registerHandlerInterceptor
<C> void send(Member destination, CommandMessage<? extends C> command) throws Exception
command
to the node assigned to handle messages with the given
routingKey
. The sender does not expect a reply.
If this method throws an exception, the sender is guaranteed that the destination of the command did not receive
it. If the method returns normally, the actual implementation of the connector defines the delivery guarantees.
Connectors route the commands based on the given routingKey
. Using the same routingKey
will result in the command being sent to the same member. Each message must be sent to exactly one
member.destination
- The member of the network to send the message tocommand
- The command to send to the (remote) memberException
- when an error occurs before or during the sending of the message<C,R> void send(Member destination, CommandMessage<C> command, CommandCallback<? super C,R> callback) throws Exception
command
to the node assigned to handle messages with the given
routingKey
. The sender expect a reply, and will be notified of the result in the given
callback
.
If this method throws an exception, the sender is guaranteed that the destination of the command did not receive
it. If the method returns normally, the actual implementation of the connector defines the delivery guarantees.
Implementations should always invoke the callback with an outcome.
If a member's connection was lost, and the result of the command is unclear, the CommandCallback.onResult(CommandMessage, CommandResultMessage)
} method is invoked with a
RemoteHandlingException
describing the failed connection. A client may choose to resend a command.
Connectors route the commands based on the given routingKey
. Using the same routingKey
will result in the command being sent to the same member.C
- The type of object expected as commandR
- The type of object expected as result of the commanddestination
- The member of the network to send the message tocommand
- The command to send to the (remote) membercallback
- The callbackException
- when an error occurs before or during the sending of the messageRegistration subscribe(String commandName, MessageHandler<? super CommandMessage<?>> handler)
commandName
.commandName
- the command name. Usually this equals the fully qualified class name of the command.handler
- the handler to subscribeCopyright © 2010–2019. All rights reserved.