use of com.swiftmq.amqp.v100.types.AMQPString in project swiftmq-ce by iitsoftware.
the class AMQPValueMapMessageFactory method create.
public AMQPMessage create(int sequenceNo) throws Exception {
AMQPMessage msg = new AMQPMessage();
Map map = new HashMap();
map.put(new AMQPString("key1"), new AMQPString("value1"));
map.put(new AMQPLong(Integer.MAX_VALUE + 1), new AMQPLong(200));
map.put(new AMQPString("key3"), new AMQPString("value1"));
map.put(new AMQPLong(Integer.MAX_VALUE + 2), new AMQPLong(400));
msg.setAmqpValue(new AmqpValue(new AMQPMap(map)));
return msg;
}
use of com.swiftmq.amqp.v100.types.AMQPString in project swiftmq-ce by iitsoftware.
the class AMQPValueStringMessageFactory method createReplyMessage.
public AMQPMessage createReplyMessage(AMQPMessage request) throws Exception {
AMQPMessage reply = new AMQPMessage();
reply.setAmqpValue(new AmqpValue(new AMQPString("RE: " + ((AMQPString) request.getAmqpValue().getValue()).getValue())));
return reply;
}
use of com.swiftmq.amqp.v100.types.AMQPString in project swiftmq-ce by iitsoftware.
the class AMQPValueStringMessageFactory method create.
public AMQPMessage create(int sequenceNo) throws Exception {
AMQPMessage msg = new AMQPMessage();
msg.setAmqpValue(new AmqpValue(new AMQPString("Message #" + sequenceNo)));
return msg;
}
use of com.swiftmq.amqp.v100.types.AMQPString in project swiftmq-ce by iitsoftware.
the class SessionHandler method sendDetach.
private void sendDetach(Handle handle, ErrorConditionIF condition, AMQPString description) {
DetachFrame detachFrame = new DetachFrame(channel);
detachFrame.setHandle(handle);
detachFrame.setClosed(AMQPBoolean.TRUE);
if (condition != null) {
Error error = new Error();
error.setCondition(condition);
if (description != null)
error.setDescription(description);
detachFrame.setError(error);
}
versionedConnection.send(detachFrame);
}
use of com.swiftmq.amqp.v100.types.AMQPString in project swiftmq-ce by iitsoftware.
the class TargetLink method transformAndStore.
private void transformAndStore(TransferFrame frame) throws EndWithErrorException {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + "/transformAndStore, frame=" + frame);
if (mySessionHandler.maxMessageSize > 0 && frame.getPayloadLength() > mySessionHandler.maxMessageSize)
throw new LinkEndException(this, LinkError.MESSAGE_SIZE_EXCEEDED, new AMQPString("Message size (" + frame.getPayloadLength() + ") > max message size (" + mySessionHandler.maxMessageSize));
if (coordinator)
handleTransactionRequest(frame);
else {
try {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + "/transformAndStore, localDestination=" + localDestination);
long payloadLength = frame.getPayloadLength();
MessageImpl msg = getTransformer(frame.getMessageFormat().getValue()).transform(frame, this);
if (msg.getJMSDestination() == null)
msg.setJMSDestination(getLocalDestination());
msg.setStringProperty(MessageImpl.PROP_CLIENT_ID, mySessionHandler.getVersionedConnection().getActiveLogin().getClientId());
if (remoteUnsettled != null) {
DeliveryTag deliveryTag = frame.getDeliveryTag();
if (remoteUnsettled.remove(deliveryTag) != null) {
msg.setBooleanProperty(MessageImpl.PROP_DOUBT_DUPLICATE, true);
if (remoteUnsettled.size() == 0)
remoteUnsettled = null;
}
}
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + "/transformAndStore, msg=" + msg);
DeliveryStateIF state = frame.getState();
if (state != null && state instanceof TransactionalState) {
TransactionalState txState = (TransactionalState) state;
TxnIdIF txnId = txState.getTxnId();
if (txnId != null) {
transactionRegistry.addToTransaction(txnId, name, msg, this);
} else
throw new SessionEndException(TransactionError.UNKNOWN_ID, new AMQPString("Missing TxnId in TransactionalState: " + txState));
} else {
QueuePushTransaction tx = sender.createTransaction();
tx.putMessage(msg);
tx.commit();
setFlowcontrolDelay(tx.getFlowControlDelay());
}
} catch (Exception e) {
throw new SessionEndException(AmqpError.INTERNAL_ERROR, new AMQPString("Exception during transformAndStore: " + e));
}
}
}
Aggregations