org.robokind.impl.messaging
Class JMSBytesSender

java.lang.Object
  extended by org.robokind.impl.messaging.JMSBytesSender
All Implemented Interfaces:
RecordSender<byte[]>

public class JMSBytesSender
extends Object
implements RecordSender<byte[]>

RecordSender for sending a raw byte array,

Author:
Matthew Stevenson

Constructor Summary
JMSBytesSender()
          Creates an empty JMSBytesSender.
 
Method Summary
 void closeProducer()
          Closes the underlying JMS MessageProducer making it unable to send Records.
 void openProducer()
          Opens the underlying JMS MessageProducer, allowing it to begin sending Records.
 void sendRecord(byte[] bytes)
          Packs the byte array into a JMS BytesMessage, and sends it.
 void sendRecord(byte[] bytes, int offset, int len, String contentType)
          Packs a segment of the byte array into a JMS BytesMessage, and sends it.
 void sendRecord(byte[] bytes, String contentType)
          Packs the byte array into a JMS BytesMessage, and sends it.
 void setDestination(javax.jms.Destination dest)
          Sets the JMS Destination to send to.
 void setSession(javax.jms.Session session)
          Sets the JMS Session to use for sending
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMSBytesSender

public JMSBytesSender()
Creates an empty JMSBytesSender.

Method Detail

setSession

public void setSession(javax.jms.Session session)
Sets the JMS Session to use for sending

Parameters:
session -

setDestination

public void setDestination(javax.jms.Destination dest)
Sets the JMS Destination to send to.

Parameters:
dest - JMS Destination to send to

closeProducer

public void closeProducer()
Closes the underlying JMS MessageProducer making it unable to send Records.


openProducer

public void openProducer()
Opens the underlying JMS MessageProducer, allowing it to begin sending Records. This must be called before Records can be sent.


sendRecord

public void sendRecord(byte[] bytes)
Packs the byte array into a JMS BytesMessage, and sends it.

Specified by:
sendRecord in interface RecordSender<byte[]>
Parameters:
bytes - byte array to send

sendRecord

public void sendRecord(byte[] bytes,
                       String contentType)
Packs the byte array into a JMS BytesMessage, and sends it. Sets the content type of the JMS header.

Parameters:
bytes - byte array to send
contentType - optional content type for the JMS header

sendRecord

public void sendRecord(byte[] bytes,
                       int offset,
                       int len,
                       String contentType)
Packs a segment of the byte array into a JMS BytesMessage, and sends it. Sets the content type of the JMS header.

Parameters:
bytes - byte array to send from
offset - byte array offset
len - number of bytes to send
contentType - optional content type for the JMS header


Copyright © 2011-2012. All Rights Reserved.