use of com.swiftmq.jms.MessageImpl in project swiftmq-ce by iitsoftware.
the class MessageSenderJob method start.
public void start(Properties properties, JobTerminationListener jobTerminationListener) throws JobException {
id = properties.getProperty(ctx.PARM);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.schedulerSwiftlet.getName(), toString() + "/start ...");
try {
MessageImpl msg = getMessage();
String type = msg.getStringProperty(ctx.PROP_SCHED_DEST_TYPE).toLowerCase();
String dest = msg.getStringProperty(ctx.PROP_SCHED_DEST);
long expiration = 0;
if (msg.propertyExists(ctx.PROP_SCHED_EXPIRATION))
expiration = msg.getLongProperty(ctx.PROP_SCHED_EXPIRATION);
List list = new ArrayList();
for (Enumeration _enum = msg.getPropertyNames(); _enum.hasMoreElements(); ) {
String name = (String) _enum.nextElement();
if (name.startsWith("JMS_SWIFTMQ_SCHEDULER"))
list.add(name);
}
for (int i = 0; i < list.size(); i++) msg.removeProperty((String) list.get(i));
if (expiration > 0)
msg.setJMSExpiration(System.currentTimeMillis() + expiration);
msg.setJMSReplyTo(null);
if (type.equals(ctx.QUEUE))
sendToQueue(dest, msg);
else
sendToTopic(dest, msg);
} catch (Exception e) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.schedulerSwiftlet.getName(), toString() + "/start, exception=" + e);
throw new JobException(e.getMessage(), e, false);
}
jobTerminationListener.jobTerminated();
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.schedulerSwiftlet.getName(), toString() + "/start done");
}
use of com.swiftmq.jms.MessageImpl in project swiftmq-ce by iitsoftware.
the class MessageSenderJob method copyMessage.
private MessageImpl copyMessage(MessageImpl msg) throws Exception {
DataByteArrayOutputStream dbos = new DataByteArrayOutputStream();
DataByteArrayInputStream dbis = new DataByteArrayInputStream();
dbos.rewind();
msg.writeContent(dbos);
dbis.reset();
dbis.setBuffer(dbos.getBuffer(), 0, dbos.getCount());
MessageImpl msgCopy = MessageImpl.createInstance(dbis.readInt());
msgCopy.readContent(dbis);
return msgCopy;
}
use of com.swiftmq.jms.MessageImpl in project swiftmq-client by iitsoftware.
the class FilePublishReply method toMessage.
public Message toMessage() throws JMSException {
Message message = new MessageImpl();
message.setIntProperty(ProtocolFactory.DUMPID_PROP, ProtocolFactory.FILEPUBLISH_REP);
message.setIntProperty(CHUNKLENGTH_PROP, chunkLength);
return fillMessage(message);
}
use of com.swiftmq.jms.MessageImpl in project swiftmq-client by iitsoftware.
the class FilePublishRequest method toMessage.
public Message toMessage() throws JMSException {
Message message = new MessageImpl();
fillMessage(message);
message.setIntProperty(ProtocolFactory.DUMPID_PROP, ProtocolFactory.FILEPUBLISH_REQ);
message.setStringProperty(REPLYQUEUE_PROP, replyQueue);
message.setStringProperty(FILENAME_PROP, filename);
if (username != null)
message.setStringProperty(USERNAME_PROP, username);
message.setLongProperty(SIZE_PROP, size);
message.setLongProperty(EXPIRATION_PROP, expiration);
message.setStringProperty(DIGESTTYPE_PROP, digestType);
if (passwordHexDigest != null)
message.setStringProperty(PWDHEXDIGEST_PROP, passwordHexDigest);
message.setIntProperty(DELAFTERDL_PROP, deleteAfterNumberDownloads);
message.setBooleanProperty(FILEISPRIVATE_PROP, fileIsPrivate);
return message;
}
use of com.swiftmq.jms.MessageImpl in project swiftmq-client by iitsoftware.
the class FileDeleteReply method toMessage.
public Message toMessage() throws JMSException {
Message message = new MessageImpl();
message.setIntProperty(ProtocolFactory.DUMPID_PROP, ProtocolFactory.FILEDELETE_REP);
return fillMessage(message);
}
Aggregations