Search in sources :

Example 16 with Error

use of com.swiftmq.amqp.v100.generated.transport.definitions.Error in project swiftmq-client by iitsoftware.

the class Link method close.

/**
 * Close this link.
 *
 * @throws AMQPException on error
 */
public void close() throws AMQPException {
    if (closed)
        return;
    Semaphore sem = new Semaphore();
    POCloseLink po = new POCloseLink(sem, this);
    mySession.getSessionDispatcher().dispatch(po);
    sem.waitHere();
    mySession.detach(this);
    closed = true;
    if (!po.isSuccess())
        throw new AMQPException(po.getException());
}
Also used : Semaphore(com.swiftmq.tools.concurrent.Semaphore) POCloseLink(com.swiftmq.amqp.v100.client.po.POCloseLink)

Example 17 with Error

use of com.swiftmq.amqp.v100.generated.transport.definitions.Error in project rabbitmq-stream-java-client by rabbitmq.

the class SwiftMqCodec method createMessage.

protected Message createMessage(byte[] data) {
    AMQPMessage amqpMessage;
    try {
        amqpMessage = new AMQPMessage(data);
    } catch (Exception e) {
        throw new StreamException("Error while decoding AMQP 1.0 message");
    }
    Object body = extractBody(amqpMessage);
    com.rabbitmq.stream.Properties properties = createProperties(amqpMessage);
    Map<String, Object> applicationProperties = createApplicationProperties(amqpMessage);
    Map<String, Object> messageAnnotations = createMessageAnnotations(amqpMessage);
    return new SwiftMqMessage(amqpMessage, body, properties, applicationProperties, messageAnnotations);
}
Also used : AMQPMessage(com.swiftmq.amqp.v100.messaging.AMQPMessage) IOException(java.io.IOException) StreamException(com.rabbitmq.stream.StreamException) StreamException(com.rabbitmq.stream.StreamException)

Aggregations

IOException (java.io.IOException)9 Error (com.swiftmq.amqp.v100.generated.transport.definitions.Error)8 AMQPMessage (com.swiftmq.amqp.v100.messaging.AMQPMessage)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Semaphore (com.swiftmq.tools.concurrent.Semaphore)3 StreamException (com.rabbitmq.stream.StreamException)2 POCloseLink (com.swiftmq.amqp.v100.client.po.POCloseLink)2 AmqpValue (com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue)2 com.swiftmq.amqp.v100.generated.transport.definitions (com.swiftmq.amqp.v100.generated.transport.definitions)2 ConnectionError (com.swiftmq.amqp.v100.generated.transport.definitions.ConnectionError)2 com.rabbitmq.stream.amqp (com.rabbitmq.stream.amqp)1 POSendMessage (com.swiftmq.amqp.v100.client.po.POSendMessage)1 Accepted (com.swiftmq.amqp.v100.generated.messaging.delivery_state.Accepted)1 DeliveryStateIF (com.swiftmq.amqp.v100.generated.messaging.delivery_state.DeliveryStateIF)1 Rejected (com.swiftmq.amqp.v100.generated.messaging.delivery_state.Rejected)1 com.swiftmq.amqp.v100.generated.messaging.message_format (com.swiftmq.amqp.v100.generated.messaging.message_format)1 AddressString (com.swiftmq.amqp.v100.generated.messaging.message_format.AddressString)1 Header (com.swiftmq.amqp.v100.generated.messaging.message_format.Header)1 MessageIdString (com.swiftmq.amqp.v100.generated.messaging.message_format.MessageIdString)1