Search in sources :

Example 26 with AmqpClient

use of org.apache.activemq.transport.amqp.client.AmqpClient in project activemq-artemis by apache.

the class AmqpSessionTest method testCreateSession.

@Test(timeout = 60000)
public void testCreateSession() throws Exception {
    AmqpClient client = createAmqpClient();
    AmqpConnection connection = addConnection(client.connect());
    AmqpSession session = connection.createSession();
    assertNotNull(session);
    connection.close();
}
Also used : AmqpConnection(org.apache.activemq.transport.amqp.client.AmqpConnection) AmqpSession(org.apache.activemq.transport.amqp.client.AmqpSession) AmqpClient(org.apache.activemq.transport.amqp.client.AmqpClient) Test(org.junit.Test)

Example 27 with AmqpClient

use of org.apache.activemq.transport.amqp.client.AmqpClient in project activemq-artemis by apache.

the class AmqpTempDestinationTest method doTestCreateDynamicSender.

@SuppressWarnings("unchecked")
protected void doTestCreateDynamicSender(boolean topic) throws Exception {
    Target target = createDynamicTarget(topic);
    AmqpClient client = createAmqpClient();
    AmqpConnection connection = addConnection(client.connect());
    AmqpSession session = connection.createSession();
    AmqpSender sender = session.createSender(target);
    assertNotNull(sender);
    Target remoteTarget = (Target) sender.getEndpoint().getRemoteTarget();
    assertTrue(remoteTarget.getDynamic());
    assertTrue(remoteTarget.getDurable().equals(TerminusDurability.NONE));
    assertTrue(remoteTarget.getExpiryPolicy().equals(TerminusExpiryPolicy.LINK_DETACH));
    // Check the dynamic node lifetime-policy
    Map<Symbol, Object> dynamicNodeProperties = remoteTarget.getDynamicNodeProperties();
    assertTrue(dynamicNodeProperties.containsKey(LIFETIME_POLICY));
    assertEquals(DeleteOnClose.getInstance(), dynamicNodeProperties.get(LIFETIME_POLICY));
    Queue queueView = getProxyToQueue(remoteTarget.getAddress());
    assertNotNull(queueView);
    connection.close();
}
Also used : AmqpConnection(org.apache.activemq.transport.amqp.client.AmqpConnection) Target(org.apache.qpid.proton.amqp.messaging.Target) AmqpSession(org.apache.activemq.transport.amqp.client.AmqpSession) Symbol(org.apache.qpid.proton.amqp.Symbol) AmqpClient(org.apache.activemq.transport.amqp.client.AmqpClient) AmqpSender(org.apache.activemq.transport.amqp.client.AmqpSender) Queue(org.apache.activemq.artemis.core.server.Queue)

Example 28 with AmqpClient

use of org.apache.activemq.transport.amqp.client.AmqpClient in project activemq-artemis by apache.

the class AmqpTempDestinationTest method doTestDynamicReceiverLifetimeBoundToLinkQueue.

protected void doTestDynamicReceiverLifetimeBoundToLinkQueue(boolean topic) throws Exception {
    Source source = createDynamicSource(topic);
    AmqpClient client = createAmqpClient();
    AmqpConnection connection = addConnection(client.connect());
    AmqpSession session = connection.createSession();
    AmqpReceiver receiver = session.createReceiver(source);
    assertNotNull(receiver);
    Source remoteSource = (Source) receiver.getEndpoint().getRemoteSource();
    Queue queueView = getProxyToQueue(remoteSource.getAddress());
    assertNotNull(queueView);
    receiver.close();
    queueView = getProxyToQueue(remoteSource.getAddress());
    assertNull(queueView);
    connection.close();
}
Also used : AmqpConnection(org.apache.activemq.transport.amqp.client.AmqpConnection) AmqpSession(org.apache.activemq.transport.amqp.client.AmqpSession) AmqpReceiver(org.apache.activemq.transport.amqp.client.AmqpReceiver) AmqpClient(org.apache.activemq.transport.amqp.client.AmqpClient) Queue(org.apache.activemq.artemis.core.server.Queue) Source(org.apache.qpid.proton.amqp.messaging.Source)

Example 29 with AmqpClient

use of org.apache.activemq.transport.amqp.client.AmqpClient in project activemq-artemis by apache.

the class AmqpTempDestinationTest method doTestCreateDynamicReceiver.

@SuppressWarnings("unchecked")
protected void doTestCreateDynamicReceiver(boolean topic) throws Exception {
    Source source = createDynamicSource(topic);
    AmqpClient client = createAmqpClient();
    AmqpConnection connection = addConnection(client.connect());
    AmqpSession session = connection.createSession();
    AmqpReceiver receiver = session.createReceiver(source);
    assertNotNull(receiver);
    Source remoteSource = (Source) receiver.getEndpoint().getRemoteSource();
    assertTrue(remoteSource.getDynamic());
    assertTrue(remoteSource.getDurable().equals(TerminusDurability.NONE));
    assertTrue(remoteSource.getExpiryPolicy().equals(TerminusExpiryPolicy.LINK_DETACH));
    // Check the dynamic node lifetime-policy
    Map<Symbol, Object> dynamicNodeProperties = remoteSource.getDynamicNodeProperties();
    assertTrue(dynamicNodeProperties.containsKey(LIFETIME_POLICY));
    assertEquals(DeleteOnClose.getInstance(), dynamicNodeProperties.get(LIFETIME_POLICY));
    Queue queueView = getProxyToQueue(remoteSource.getAddress());
    assertNotNull(queueView);
    connection.close();
}
Also used : AmqpConnection(org.apache.activemq.transport.amqp.client.AmqpConnection) AmqpSession(org.apache.activemq.transport.amqp.client.AmqpSession) AmqpReceiver(org.apache.activemq.transport.amqp.client.AmqpReceiver) Symbol(org.apache.qpid.proton.amqp.Symbol) AmqpClient(org.apache.activemq.transport.amqp.client.AmqpClient) Queue(org.apache.activemq.artemis.core.server.Queue) Source(org.apache.qpid.proton.amqp.messaging.Source)

Example 30 with AmqpClient

use of org.apache.activemq.transport.amqp.client.AmqpClient in project activemq-artemis by apache.

the class AmqpTempDestinationTest method doTestDynamicSenderLifetimeBoundToLinkQueue.

protected void doTestDynamicSenderLifetimeBoundToLinkQueue(boolean topic) throws Exception {
    Target target = createDynamicTarget(topic);
    AmqpClient client = createAmqpClient();
    AmqpConnection connection = addConnection(client.connect());
    AmqpSession session = connection.createSession();
    AmqpSender sender = session.createSender(target);
    assertNotNull(sender);
    Target remoteTarget = (Target) sender.getEndpoint().getRemoteTarget();
    Queue queueView = getProxyToQueue(remoteTarget.getAddress());
    assertNotNull(queueView);
    sender.close();
    queueView = getProxyToQueue(remoteTarget.getAddress());
    assertNull(queueView);
    connection.close();
}
Also used : AmqpConnection(org.apache.activemq.transport.amqp.client.AmqpConnection) Target(org.apache.qpid.proton.amqp.messaging.Target) AmqpSession(org.apache.activemq.transport.amqp.client.AmqpSession) AmqpClient(org.apache.activemq.transport.amqp.client.AmqpClient) AmqpSender(org.apache.activemq.transport.amqp.client.AmqpSender) Queue(org.apache.activemq.artemis.core.server.Queue)

Aggregations

AmqpClient (org.apache.activemq.transport.amqp.client.AmqpClient)183 AmqpConnection (org.apache.activemq.transport.amqp.client.AmqpConnection)183 AmqpSession (org.apache.activemq.transport.amqp.client.AmqpSession)168 Test (org.junit.Test)158 AmqpReceiver (org.apache.activemq.transport.amqp.client.AmqpReceiver)123 AmqpMessage (org.apache.activemq.transport.amqp.client.AmqpMessage)114 AmqpSender (org.apache.activemq.transport.amqp.client.AmqpSender)91 Queue (org.apache.activemq.artemis.core.server.Queue)70 Source (org.apache.qpid.proton.amqp.messaging.Source)25 AddressInfo (org.apache.activemq.artemis.core.server.impl.AddressInfo)22 AmqpValidator (org.apache.activemq.transport.amqp.client.AmqpValidator)21 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)14 Receiver (org.apache.qpid.proton.engine.Receiver)12 CountDownLatch (java.util.concurrent.CountDownLatch)8 Map (java.util.Map)7 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)7 RemotingConnection (org.apache.activemq.artemis.spi.core.protocol.RemotingConnection)7 Sender (org.apache.qpid.proton.engine.Sender)7 URI (java.net.URI)6 HashMap (java.util.HashMap)6