use of com.swiftmq.jms.QueueImpl in project swiftmq-ce by iitsoftware.
the class TransactedQueueSession method visitCreateProducerRequest.
public void visitCreateProducerRequest(CreateProducerRequest req) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitCreateProducerRequest");
CreateProducerReply reply = (CreateProducerReply) req.createReply();
try {
ctx.activeLogin.getResourceLimitGroup().incProducers();
} catch (ResourceLimitException e) {
reply.setOk(false);
reply.setException(new JMSException(e.toString()));
reply.send();
return;
}
QueueImpl queue = req.getQueue();
try {
int producerId;
QueueProducer producer;
producerId = ArrayListTool.setFirstFreeOrExpand(producerList, null);
producer = new QueueProducer(ctx, queue.getQueueName());
producerList.set(producerId, producer);
reply.setQueueProducerId(producerId);
reply.setOk(true);
if (senderEntityList != null) {
Entity senderEntity = senderEntityList.createEntity();
senderEntity.setName(queue.getQueueName() + "-" + producerId);
senderEntity.setDynamicObject(producer);
senderEntity.createCommands();
Property prop = senderEntity.getProperty("queue");
prop.setValue(queue.getQueueName());
prop.setReadOnly(true);
senderEntityList.addEntity(senderEntity);
}
// enlist it at the transaction manager
transactionManager.addTransactionFactory(producer);
} catch (Exception e) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/exception creating producer: " + e.getMessage());
ctx.logSwiftlet.logError("sys$jms", ctx.tracePrefix + "/exception creating producer: " + e.getMessage());
reply.setOk(false);
reply.setException((e instanceof JMSException) ? e : new javax.jms.JMSException(e.toString()));
ctx.activeLogin.getResourceLimitGroup().decProducers();
}
reply.send();
}
use of com.swiftmq.jms.QueueImpl in project swiftmq-ce by iitsoftware.
the class TopicAnnounceSender method send.
// <-- Exposed Methods
private void send(String dest, QueueSender sender, VersionObject vo) throws Exception {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.topicManager.getName(), toString() + "/send, dest: " + dest + ", vo: " + vo);
dos.rewind();
dos.writeInt(vo.getDumpId());
vo.writeContent(dos);
BytesMessageImpl msg = new BytesMessageImpl();
msg.writeBytes(dos.getBuffer(), 0, dos.getCount());
msg.setJMSPriority(MessageImpl.MAX_PRIORITY);
msg.setJMSDestination(new QueueImpl(TopicManagerImpl.TOPIC_QUEUE + "@" + dest));
QueuePushTransaction transaction = sender.createTransaction();
transaction.putMessage(msg);
transaction.commit();
}
use of com.swiftmq.jms.QueueImpl in project swiftmq-client by iitsoftware.
the class CreateProducerRequest method readContent.
/**
* Read the content of this object from the stream.
*
* @param in input stream
* @throws IOException if an error occurs
*/
public void readContent(DataInput in) throws IOException {
super.readContent(in);
byte set = in.readByte();
if (set == 0) {
queue = null;
} else {
queue = new QueueImpl(in.readUTF());
}
}
Aggregations