Search in sources :

Example 6 with AMQPString

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;
}
Also used : AMQPMap(com.swiftmq.amqp.v100.types.AMQPMap) HashMap(java.util.HashMap) AMQPLong(com.swiftmq.amqp.v100.types.AMQPLong) AMQPString(com.swiftmq.amqp.v100.types.AMQPString) AMQPMessage(com.swiftmq.amqp.v100.messaging.AMQPMessage) AMQPMap(com.swiftmq.amqp.v100.types.AMQPMap) Map(java.util.Map) HashMap(java.util.HashMap) AmqpValue(com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue)

Example 7 with AMQPString

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;
}
Also used : AMQPString(com.swiftmq.amqp.v100.types.AMQPString) AMQPMessage(com.swiftmq.amqp.v100.messaging.AMQPMessage) AmqpValue(com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue)

Example 8 with AMQPString

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;
}
Also used : AMQPString(com.swiftmq.amqp.v100.types.AMQPString) AMQPMessage(com.swiftmq.amqp.v100.messaging.AMQPMessage) AmqpValue(com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue)

Example 9 with AMQPString

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);
}
Also used : Error(com.swiftmq.amqp.v100.generated.transport.definitions.Error)

Example 10 with AMQPString

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));
        }
    }
}
Also used : QueuePushTransaction(com.swiftmq.swiftlet.queue.QueuePushTransaction) DeliveryStateIF(com.swiftmq.amqp.v100.generated.messaging.delivery_state.DeliveryStateIF) MessageImpl(com.swiftmq.jms.MessageImpl) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) AuthenticationException(com.swiftmq.swiftlet.auth.AuthenticationException) QueueException(com.swiftmq.swiftlet.queue.QueueException) InvalidSelectorException(javax.jms.InvalidSelectorException) TopicException(com.swiftmq.swiftlet.topic.TopicException)

Aggregations

AMQPString (com.swiftmq.amqp.v100.types.AMQPString)29 AMQPMessage (com.swiftmq.amqp.v100.messaging.AMQPMessage)24 AmqpValue (com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue)17 HashMap (java.util.HashMap)14 Map (java.util.Map)14 IOException (java.io.IOException)13 AMQPContext (com.swiftmq.amqp.AMQPContext)9 AMQPMap (com.swiftmq.amqp.v100.types.AMQPMap)8 JSSESocketFactory (com.swiftmq.net.JSSESocketFactory)8 ApplicationProperties (com.swiftmq.amqp.v100.generated.messaging.message_format.ApplicationProperties)6 Properties (com.swiftmq.amqp.v100.generated.messaging.message_format.Properties)6 QueueException (com.swiftmq.swiftlet.queue.QueueException)5 AMQPException (com.swiftmq.amqp.v100.client.AMQPException)4 AddressString (com.swiftmq.amqp.v100.generated.messaging.message_format.AddressString)4 TxnIdIF (com.swiftmq.amqp.v100.generated.transactions.coordination.TxnIdIF)4 Milliseconds (com.swiftmq.amqp.v100.generated.transport.definitions.Milliseconds)4 SequenceNo (com.swiftmq.amqp.v100.generated.transport.definitions.SequenceNo)4 AMQPBoolean (com.swiftmq.amqp.v100.types.AMQPBoolean)4 Iterator (java.util.Iterator)4 Connection (com.swiftmq.amqp.v100.client.Connection)3