org.axonframework.commandhandling.distributed.jgroups
Class DispatchMessage

java.lang.Object
  extended by org.axonframework.commandhandling.distributed.jgroups.DispatchMessage
All Implemented Interfaces:
Externalizable, Serializable, org.jgroups.util.Streamable

public class DispatchMessage
extends Object
implements org.jgroups.util.Streamable, Externalizable

JGroups message that contains a CommandMessage that needs to be dispatched on a remote command bus segment. This class implements the Streamable interface for faster JGroups-specific serialization, but also supports Java serialization by implementing the Externalizable interface.

Since:
2.0
Author:
Allard Buijze
See Also:
Serialized Form

Constructor Summary
DispatchMessage()
          Default constructor required by the Streamable and Externalizable interfaces.
DispatchMessage(CommandMessage<?> commandMessage, Serializer serializer, boolean expectReply)
          Initialized a DispatchMessage for the given commandMessage, to be serialized using given serializer.
 
Method Summary
 String getCommandIdentifier()
          Returns the identifier of the command carried by this instance.
 CommandMessage<?> getCommandMessage(Serializer serializer)
          Returns the CommandMessage wrapped in this Message.
 boolean isExpectReply()
          Indicates whether the sender of this message requests a reply.
 void readExternal(ObjectInput in)
           
 void readFrom(DataInput in)
           
 void writeExternal(ObjectOutput out)
           
 void writeTo(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DispatchMessage

public DispatchMessage()
Default constructor required by the Streamable and Externalizable interfaces. Do not use directly.


DispatchMessage

public DispatchMessage(CommandMessage<?> commandMessage,
                       Serializer serializer,
                       boolean expectReply)
Initialized a DispatchMessage for the given commandMessage, to be serialized using given serializer. expectReply indicates whether the sender will be expecting a reply.

Parameters:
commandMessage - The message to send to the remote segment
serializer - The serialize to serialize the message payload and metadata with
expectReply - whether or not the sender is waiting for a reply.
Method Detail

isExpectReply

public boolean isExpectReply()
Indicates whether the sender of this message requests a reply.

Returns:
true if a reply is expected, otherwise false.

getCommandMessage

public CommandMessage<?> getCommandMessage(Serializer serializer)
Returns the CommandMessage wrapped in this Message.

Parameters:
serializer - The serialize to deserialize message contents with
Returns:
the CommandMessage wrapped in this Message

getCommandIdentifier

public String getCommandIdentifier()
Returns the identifier of the command carried by this instance.

Returns:
the identifier of the command carried by this instance

writeTo

public void writeTo(DataOutput out)
             throws IOException
Specified by:
writeTo in interface org.jgroups.util.Streamable
Throws:
IOException

readFrom

public void readFrom(DataInput in)
              throws IOException
Specified by:
readFrom in interface org.jgroups.util.Streamable
Throws:
IOException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException
Specified by:
readExternal in interface Externalizable
Throws:
IOException


Copyright © 2010-2016. All Rights Reserved.