Search in sources :

Example 16 with AmqpValue

use of com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue in project swiftmq-ce by iitsoftware.

the class AMQPValueByteMessageFactory method createReplyMessage.

public AMQPMessage createReplyMessage(AMQPMessage request) throws Exception {
    AMQPMessage reply = new AMQPMessage();
    reply.setAmqpValue(new AmqpValue(new AMQPByte((byte) 100)));
    return reply;
}
Also used : AMQPByte(com.swiftmq.amqp.v100.types.AMQPByte) AMQPMessage(com.swiftmq.amqp.v100.messaging.AMQPMessage) AmqpValue(com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue)

Example 17 with AmqpValue

use of com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue in project swiftmq-ce by iitsoftware.

the class AMQPValueByteMessageFactory method create.

public AMQPMessage create(int sequenceNo) throws Exception {
    AMQPMessage msg = new AMQPMessage();
    msg.setAmqpValue(new AmqpValue(new AMQPByte((byte) 100)));
    return msg;
}
Also used : AMQPByte(com.swiftmq.amqp.v100.types.AMQPByte) AMQPMessage(com.swiftmq.amqp.v100.messaging.AMQPMessage) AmqpValue(com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue)

Example 18 with AmqpValue

use of com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue in project swiftmq-ce by iitsoftware.

the class AMQPValueByteMessageFactory method verify.

public void verify(AMQPMessage message) throws Exception {
    AmqpValue value = message.getAmqpValue();
    if (value == null)
        throw new Exception(("verify - no AmqpValue section found!"));
    AMQPType t = value.getValue();
    if (!(t instanceof AMQPByte))
        throw new Exception(("verify - AmqpValue does not contain an AmqpByte!"));
    if (((AMQPByte) t).getValue() != (byte) 100)
        throw new Exception("verify - invalid value: " + ((AMQPByte) t).getValue());
}
Also used : AMQPType(com.swiftmq.amqp.v100.types.AMQPType) AMQPByte(com.swiftmq.amqp.v100.types.AMQPByte) AmqpValue(com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue)

Example 19 with AmqpValue

use of com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue in project swiftmq-ce by iitsoftware.

the class AMQPValueMapMessageFactory method createReplyMessage.

public AMQPMessage createReplyMessage(AMQPMessage request) throws Exception {
    AMQPMessage reply = new AMQPMessage();
    Map map = ((AMQPMap) request.getAmqpValue().getValue()).getValue();
    map.put(new AMQPString("REPLY"), new AMQPString("REPLY"));
    reply.setAmqpValue(new AmqpValue(new AMQPMap(map)));
    return reply;
}
Also used : AMQPMap(com.swiftmq.amqp.v100.types.AMQPMap) 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 20 with AmqpValue

use of com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue in project swiftmq-ce by iitsoftware.

the class AMQPValueStringMessageFactory method verify.

public void verify(AMQPMessage message) throws Exception {
    AmqpValue value = message.getAmqpValue();
    if (value == null)
        throw new Exception(("verify - no AmqpValue section found!"));
    AMQPString s = (AMQPString) value.getValue();
    if (!s.getValue().startsWith("Message #"))
        throw new Exception("verify - invalid value detected: " + s.getValue());
}
Also used : AMQPString(com.swiftmq.amqp.v100.types.AMQPString) AmqpValue(com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue)

Aggregations

AmqpValue (com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue)23 AMQPMessage (com.swiftmq.amqp.v100.messaging.AMQPMessage)18 AMQPString (com.swiftmq.amqp.v100.types.AMQPString)17 AMQPContext (com.swiftmq.amqp.AMQPContext)9 JSSESocketFactory (com.swiftmq.net.JSSESocketFactory)8 AMQPMap (com.swiftmq.amqp.v100.types.AMQPMap)5 Map (java.util.Map)5 HashMap (java.util.HashMap)4 Connection (com.swiftmq.amqp.v100.client.Connection)3 Session (com.swiftmq.amqp.v100.client.Session)3 Properties (com.swiftmq.amqp.v100.generated.messaging.message_format.Properties)3 TxnIdIF (com.swiftmq.amqp.v100.generated.transactions.coordination.TxnIdIF)3 AMQPByte (com.swiftmq.amqp.v100.types.AMQPByte)3 AMQPType (com.swiftmq.amqp.v100.types.AMQPType)3 AddressIF (com.swiftmq.amqp.v100.generated.messaging.message_format.AddressIF)2 AmqpSequence (com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpSequence)2 Data (com.swiftmq.amqp.v100.generated.messaging.message_format.Data)2 AMQPBoolean (com.swiftmq.amqp.v100.types.AMQPBoolean)2 AMQPLong (com.swiftmq.amqp.v100.types.AMQPLong)2 Iterator (java.util.Iterator)2