Search in sources :

Example 16 with RMQDestination

use of com.rabbitmq.jms.admin.RMQDestination in project rabbitmq-jms-client by rabbitmq.

the class RMQSession method createTopic.

/**
 * {@inheritDoc}
 */
@Override
public Topic createTopic(String topicName) throws JMSException {
    illegalStateExceptionIfClosed();
    RMQDestination dest = new RMQDestination(topicName, false, false);
    declareTopic(dest);
    return dest;
}
Also used : RMQDestination(com.rabbitmq.jms.admin.RMQDestination)

Example 17 with RMQDestination

use of com.rabbitmq.jms.admin.RMQDestination in project rabbitmq-jms-client by rabbitmq.

the class RMQSession method createQueue.

/**
 * {@inheritDoc}
 */
@Override
public Queue createQueue(String queueName) throws JMSException {
    illegalStateExceptionIfClosed();
    RMQDestination dest = new RMQDestination(queueName, true, false);
    declareRMQQueue(dest, null, false, true);
    return dest;
}
Also used : RMQDestination(com.rabbitmq.jms.admin.RMQDestination)

Example 18 with RMQDestination

use of com.rabbitmq.jms.admin.RMQDestination in project rabbitmq-jms-client by rabbitmq.

the class AmqpPropertiesCustomiserIT method customiserIsApplied.

@Test
public void customiserIsApplied() throws Exception {
    channel.queueDeclare(QUEUE_NAME, // durable
    false, // exclusive
    true, // autoDelete
    true, // options
    null);
    queueConn.start();
    QueueSession queueSession = queueConn.createQueueSession(false, Session.DUPS_OK_ACKNOWLEDGE);
    // write-only AMQP-mapped queue
    Queue queue = new RMQDestination(QUEUE_NAME, "", QUEUE_NAME, null);
    QueueSender queueSender = queueSession.createSender(queue);
    TextMessage message = queueSession.createTextMessage(MESSAGE);
    queueSender.send(message);
    queueConn.close();
    GetResponse response = channel.basicGet(QUEUE_NAME, false);
    assertNotNull(response, "basicGet failed to retrieve a response");
    byte[] body = response.getBody();
    assertNotNull(body, "body of response is null");
    assertEquals(new String(body), MESSAGE, "body of response is not correct");
    assertEquals(response.getProps().getContentType(), TEXT_PLAIN, "body of response is not correct");
}
Also used : RMQDestination(com.rabbitmq.jms.admin.RMQDestination) QueueSender(javax.jms.QueueSender) Queue(javax.jms.Queue) GetResponse(com.rabbitmq.client.GetResponse) QueueSession(javax.jms.QueueSession) TextMessage(javax.jms.TextMessage) Test(org.junit.jupiter.api.Test)

Aggregations

RMQDestination (com.rabbitmq.jms.admin.RMQDestination)18 Test (org.junit.jupiter.api.Test)8 Queue (javax.jms.Queue)7 QueueSession (javax.jms.QueueSession)7 TextMessage (javax.jms.TextMessage)6 HashMap (java.util.HashMap)5 QueueSender (javax.jms.QueueSender)5 HashSet (java.util.HashSet)4 AMQP (com.rabbitmq.client.AMQP)3 GetResponse (com.rabbitmq.client.GetResponse)3 MessageConsumer (javax.jms.MessageConsumer)3 QueueReceiver (javax.jms.QueueReceiver)3 Map (java.util.Map)2 BytesMessage (javax.jms.BytesMessage)2 JMSException (javax.jms.JMSException)2 Session (javax.jms.Session)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 MethodSource (org.junit.jupiter.params.provider.MethodSource)2 Channel (com.rabbitmq.client.Channel)1 RMQDestinationTest (com.rabbitmq.jms.admin.RMQDestinationTest)1