Search in sources :

Example 36 with ReplyTo

use of org.apache.qpid.server.protocol.v0_10.transport.ReplyTo in project qpid-broker-j by apache.

the class PropertyConverter_Internal_to_v0_10Test method testReplyToConversionWhenQueueIsSpecified.

public void testReplyToConversionWhenQueueIsSpecified() throws IOException {
    final AMQMessageHeader header = mock(AMQMessageHeader.class);
    final String replyTo = "myTestQueue";
    final Queue queue = mock(Queue.class);
    when(queue.getName()).thenReturn(replyTo);
    when(_addressSpace.getAttainedMessageDestination(replyTo)).thenReturn(queue);
    when(header.getReplyTo()).thenReturn(replyTo);
    InternalMessage originalMessage = createTestMessage(header);
    MessageTransferMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
    final ReplyTo convertedReplyTo = convertedMessage.getHeader().getMessageProperties().getReplyTo();
    assertEquals("Unexpected exchange", "", convertedReplyTo.getExchange());
    assertEquals("Unexpected routing key", replyTo, convertedReplyTo.getRoutingKey());
}
Also used : ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) AMQMessageHeader(org.apache.qpid.server.message.AMQMessageHeader) Matchers.anyString(org.mockito.Matchers.anyString) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) Queue(org.apache.qpid.server.model.Queue)

Example 37 with ReplyTo

use of org.apache.qpid.server.protocol.v0_10.transport.ReplyTo in project qpid-broker-j by apache.

the class MessageConverter_Internal_to_v0_10 method getReplyTo.

private ReplyTo getReplyTo(final NamedAddressSpace addressSpace, final String origReplyTo) {
    DestinationAddress destinationAddress = new DestinationAddress(addressSpace, origReplyTo);
    MessageDestination messageDestination = destinationAddress.getMessageDestination();
    final String exchange = ensureStr8("reply-to[\"exchange\"]", messageDestination instanceof Exchange ? messageDestination.getName() : "");
    final String routingKey = ensureStr8("reply-to[\"routing-key\"]", messageDestination instanceof Queue ? messageDestination.getName() : destinationAddress.getRoutingKey());
    return new ReplyTo(exchange, routingKey);
}
Also used : Exchange(org.apache.qpid.server.model.Exchange) ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) MessageDestination(org.apache.qpid.server.message.MessageDestination) Queue(org.apache.qpid.server.model.Queue) DestinationAddress(org.apache.qpid.server.model.DestinationAddress)

Aggregations

MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)31 ReplyTo (org.apache.qpid.server.protocol.v0_10.transport.ReplyTo)31 MessageTransferMessage (org.apache.qpid.server.protocol.v0_10.MessageTransferMessage)21 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)15 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)14 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)12 Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)12 Message_1_0 (org.apache.qpid.server.protocol.v1_0.Message_1_0)11 AMQMessage (org.apache.qpid.server.protocol.v0_8.AMQMessage)10 Matchers.anyString (org.mockito.Matchers.anyString)10 InternalMessage (org.apache.qpid.server.message.internal.InternalMessage)9 Exchange (org.apache.qpid.server.model.Exchange)8 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)7 AMQMessageHeader (org.apache.qpid.server.message.AMQMessageHeader)5 Queue (org.apache.qpid.server.model.Queue)4 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)4 MessageDestination (org.apache.qpid.server.message.MessageDestination)3 HashMap (java.util.HashMap)2 DestinationAddress (org.apache.qpid.server.model.DestinationAddress)2 Header (org.apache.qpid.server.protocol.v0_10.transport.Header)2