com.neeve.toa
Interface MessageSender

All Known Implementing Classes:
TopicOrientedApplication

public interface MessageSender

Interface for sending messages in a Topic Oriented Applications.

In topic oriented applications, service definitions bind message types to MessageChannel that encapsulate the topics on which messages are transported by default.

The MessageSender interface provides methods that lookup up the channel associated with a given message type as defined by the application's service definitions. Additionally it provides sendMessage variants allowing the caller to override the topic and provide a customized key resolution table for resolving dynamic portions of the channel key.

NOTE: A MessageSender may be backed by one and only one TopicOrientedApplication and is tied to that application's lifecycle and transaction context. Applications that send outbound messages via a MessageSender as the result of processing an inbound message must have received the message from the same AepEngine that backs the MessageSender's TopicOrientedApplication, failure to do so would break the atomicity guarantees of inbound/outbound message and can in certain situations lead to deadlocks.

Threading Implementations of this class are not thread safe. Send calls may only be called from an EventHandler that originates from the AepEngine that backs the TopicOrientedApplication from whence this MessageSender came, or in a non concurrent fashion by an unsolicited 'sender' thread if this is a purely producer application.

See Also:
AepEngine.sendMessage(MessageChannel, IRogMessage), AepEngine, TopicOrientedApplication, MessageChannel

Method Summary
 void sendMessage(IRogMessage message)
          Sends a message using the message's default channel.
 void sendMessage(IRogMessage message, MessageChannel.RawKeyResolutionTable rawKeyResolutionTable)
          Sends a message using the provide zero garbage key resolution table.
 void sendMessage(IRogMessage message, Properties keyResolutionTable)
          Sends a message using the provided key resolution table.
 void sendMessage(IRogMessage message, String topic)
          Sends a message using the given topic as the channel key.
 void sendMessage(IRogMessage message, XString topic)
          Sends a message using the given topic as the channel key (zero garbage variant).
 

Method Detail

sendMessage

void sendMessage(IRogMessage message)
Sends a message using the message's default channel. This method has the same semantics as AepEngine.sendMessage(MessageChannel, IRogMessage), with the message channel resolved based on this application's service definition for the message type and the provided message.

Parameters:
message - The message to send.
See Also:
AepEngine.sendMessage(MessageChannel, IRogMessage)
Threading:
This method is not safe for concurrent access by multiple threads with itself or any of the other engine / TOA methods.

sendMessage

void sendMessage(IRogMessage message,
                 String topic)
Sends a message using the given topic as the channel key. This method has the same semantics as AepEngine.sendMessage(MessageChannel, IRogMessage, String, Properties), with the message channel resolved based on this application's service definition for the message type, the provided message, the provided topic as the channel key, and no key resolution table.

Parameters:
message - The message to send.
See Also:
AepEngine.sendMessage(MessageChannel, IRogMessage)
Threading:
This method is not safe for concurrent access by multiple threads with itself or any of the other engine / TOA methods.

sendMessage

void sendMessage(IRogMessage message,
                 Properties keyResolutionTable)
Sends a message using the provided key resolution table. This method has the same semantics as AepEngine.sendMessage(MessageChannel, IRogMessage, Properties), with the message channel resolved based on this application's service definition for the message type, the provided message, key, and the provided message key.

Parameters:
message - The message to send.
See Also:
AepEngine.sendMessage(MessageChannel, IRogMessage)
Threading:
This method is not safe for concurrent access by multiple threads with itself or any of the other engine / TOA methods.

sendMessage

void sendMessage(IRogMessage message,
                 XString topic)
Sends a message using the given topic as the channel key (zero garbage variant). This method has the same semantics as AepEngine.sendMessage(MessageChannel, IRogMessage, XString, MessageChannel.RawKeyResolutionTable), with the message channel resolved based on this application's service definition for the message type, the provided message, the provided topic as the channel key, and no key resolution table.

Parameters:
message - The message to send.
See Also:
AepEngine.sendMessage(MessageChannel, IRogMessage)
Threading:
This method is not safe for concurrent access by multiple threads with itself or any of the other engine / TOA methods.

sendMessage

void sendMessage(IRogMessage message,
                 MessageChannel.RawKeyResolutionTable rawKeyResolutionTable)
Sends a message using the provide zero garbage key resolution table. This method has the same semantics as AepEngine.sendMessage(MessageChannel, IRogMessage, MessageChannel.RawKeyResolutionTable), with the message channel resolved based on this application's service definition for the message type, the provided message, and no key resolution table.

Parameters:
message - The message to send.
See Also:
AepEngine.sendMessage(MessageChannel, IRogMessage)
Threading:
This method is not safe for concurrent access by multiple threads with itself or any of the other engine / TOA methods.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.