Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq.io
Interface WireFormat  view WireFormat download WireFormat.java

All Known Implementing Classes:
AbstractWireFormat

public interface WireFormat

Represents a strategy of encoding packets on the wire or on disk using some kind of serialization or wire format.

We use a default efficient format for Java to Java communication but other formats to other systems can be used, such as using simple text strings when talking to JavaScript or coming up with other formats for talking to C / C# languages or proprietary messaging systems we wish to interface with at the wire level etc.

Version:
$Revision: 1.1.1.1 $

Field Summary
static int DEFAULT_MAXIMUM_MESSAGE_SIZE
          The maximum message size supported by the transport If the message is bigger than this size, then the message will be 'chunked' into separate pieces and re-assembled on the consumer
 
Method Summary
 boolean canProcessWireFormatVersion(int version)
          Can this wireformat process packets of this version
 WireFormat copy()
          Creates a new copy of this wire format so it can be used in another thread/context
 boolean doesSupportMessageCompression()
          Some wire formats will not be able to understand compressed messages
 boolean doesSupportMessageFragmentation()
          some wire formats will implement their own fragementation
 org.activemq.message.Packet fromBytes(byte[] bytes)
          Reads the packet from the given byte[]
 org.activemq.message.Packet fromBytes(byte[] bytes, int offset, int length)
          Reads the packet from the given byte[]
 int getCurrentWireFormatVersion()
           
 void initiateClientSideProtocol()
          Some wire formats require a handshake at start-up
 void initiateServerSideProtocol()
          Some wire formats require a handshake at start-up
 boolean isCachingEnabled()
           
 org.activemq.message.Packet readPacket(java.io.DataInput in)
          Reads a packet from the given input stream
 org.activemq.message.Packet readPacket(int firstByte, java.io.DataInput in)
          A helper method for working with sockets where the first byte is read first, then the rest of the message is read.
 org.activemq.message.Packet readPacket(java.lang.String channelID, java.net.DatagramPacket dpacket)
          Read a packet from a Datagram packet from the given channelID.
 void registerTransportStreams(java.io.DataOutputStream dataOut, java.io.DataInputStream dataIn)
          some transports may register their streams (e.g.
 void setCachingEnabled(boolean enableCaching)
           
 byte[] toBytes(org.activemq.message.Packet packet)
          A helper method which converts a packet into a byte array
 org.activemq.message.Packet writePacket(org.activemq.message.Packet packet, java.io.DataOutput out)
          Writes the packet to the given output stream
 java.net.DatagramPacket writePacket(java.lang.String channelID, org.activemq.message.Packet packet)
          Writes the given package to a new datagram
 

Field Detail

DEFAULT_MAXIMUM_MESSAGE_SIZE

public static final int DEFAULT_MAXIMUM_MESSAGE_SIZE
The maximum message size supported by the transport If the message is bigger than this size, then the message will be 'chunked' into separate pieces and re-assembled on the consumer

See Also:
Constant Field Values
Method Detail

readPacket

public org.activemq.message.Packet readPacket(java.io.DataInput in)
                                       throws java.io.IOException
Reads a packet from the given input stream


readPacket

public org.activemq.message.Packet readPacket(int firstByte,
                                              java.io.DataInput in)
                                       throws java.io.IOException
A helper method for working with sockets where the first byte is read first, then the rest of the message is read.

Its common when dealing with sockets to have different timeout semantics until the first non-zero byte is read of a message, after which time a zero timeout is used.


readPacket

public org.activemq.message.Packet readPacket(java.lang.String channelID,
                                              java.net.DatagramPacket dpacket)
                                       throws java.io.IOException
Read a packet from a Datagram packet from the given channelID. If the packet is from the same channel ID as it was sent then we have a loop-back so discard the packet


writePacket

public org.activemq.message.Packet writePacket(org.activemq.message.Packet packet,
                                               java.io.DataOutput out)
                                        throws java.io.IOException,
                                               javax.jms.JMSException
Writes the packet to the given output stream


writePacket

public java.net.DatagramPacket writePacket(java.lang.String channelID,
                                           org.activemq.message.Packet packet)
                                    throws java.io.IOException,
                                           javax.jms.JMSException
Writes the given package to a new datagram


fromBytes

public org.activemq.message.Packet fromBytes(byte[] bytes,
                                             int offset,
                                             int length)
                                      throws java.io.IOException
Reads the packet from the given byte[]


fromBytes

public org.activemq.message.Packet fromBytes(byte[] bytes)
                                      throws java.io.IOException
Reads the packet from the given byte[]


toBytes

public byte[] toBytes(org.activemq.message.Packet packet)
               throws java.io.IOException,
                      javax.jms.JMSException
A helper method which converts a packet into a byte array


copy

public WireFormat copy()
Creates a new copy of this wire format so it can be used in another thread/context


canProcessWireFormatVersion

public boolean canProcessWireFormatVersion(int version)
Can this wireformat process packets of this version


getCurrentWireFormatVersion

public int getCurrentWireFormatVersion()

registerTransportStreams

public void registerTransportStreams(java.io.DataOutputStream dataOut,
                                     java.io.DataInputStream dataIn)
some transports may register their streams (e.g. Tcp)


initiateClientSideProtocol

public void initiateClientSideProtocol()
                                throws java.io.IOException
Some wire formats require a handshake at start-up


initiateServerSideProtocol

public void initiateServerSideProtocol()
                                throws java.io.IOException
Some wire formats require a handshake at start-up


isCachingEnabled

public boolean isCachingEnabled()

setCachingEnabled

public void setCachingEnabled(boolean enableCaching)

doesSupportMessageFragmentation

public boolean doesSupportMessageFragmentation()
some wire formats will implement their own fragementation


doesSupportMessageCompression

public boolean doesSupportMessageCompression()
Some wire formats will not be able to understand compressed messages