Search in sources :

Example 91 with ProducerInfo

use of org.apache.activemq.command.ProducerInfo in project activemq-artemis by apache.

the class ProducerInfoTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ProducerInfo info = (ProducerInfo) object;
    info.setProducerId(createProducerId("ProducerId:1"));
    info.setDestination(createActiveMQDestination("Destination:2"));
    {
        BrokerId[] value = new BrokerId[2];
        for (int i = 0; i < 2; i++) {
            value[i] = createBrokerId("BrokerPath:3");
        }
        info.setBrokerPath(value);
    }
    info.setDispatchAsync(true);
    info.setWindowSize(1);
}
Also used : ProducerInfo(org.apache.activemq.command.ProducerInfo)

Example 92 with ProducerInfo

use of org.apache.activemq.command.ProducerInfo in project activemq-artemis by apache.

the class ProducerInfoTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ProducerInfo info = (ProducerInfo) object;
    info.setProducerId(createProducerId("ProducerId:1"));
    info.setDestination(createActiveMQDestination("Destination:2"));
    {
        BrokerId[] value = new BrokerId[2];
        for (int i = 0; i < 2; i++) {
            value[i] = createBrokerId("BrokerPath:3");
        }
        info.setBrokerPath(value);
    }
    info.setDispatchAsync(true);
    info.setWindowSize(1);
}
Also used : ProducerInfo(org.apache.activemq.command.ProducerInfo)

Example 93 with ProducerInfo

use of org.apache.activemq.command.ProducerInfo in project activemq-artemis by apache.

the class ProducerInfoTest method createObject.

@Override
public Object createObject() throws Exception {
    ProducerInfo info = new ProducerInfo();
    populateObject(info);
    return info;
}
Also used : ProducerInfo(org.apache.activemq.command.ProducerInfo)

Example 94 with ProducerInfo

use of org.apache.activemq.command.ProducerInfo in project activemq-artemis by apache.

the class ProducerInfoTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ProducerInfo info = (ProducerInfo) object;
    info.setProducerId(createProducerId("ProducerId:1"));
    info.setDestination(createActiveMQDestination("Destination:2"));
    {
        BrokerId[] value = new BrokerId[2];
        for (int i = 0; i < 2; i++) {
            value[i] = createBrokerId("BrokerPath:3");
        }
        info.setBrokerPath(value);
    }
    info.setDispatchAsync(true);
    info.setWindowSize(1);
}
Also used : ProducerInfo(org.apache.activemq.command.ProducerInfo)

Example 95 with ProducerInfo

use of org.apache.activemq.command.ProducerInfo in project activemq-artemis by apache.

the class ProxyConnectorTest method testSendAndConsume.

public void testSendAndConsume() throws Exception {
    // Start a producer on local broker using the proxy
    StubConnection connection1 = createProxyConnection();
    ConnectionInfo connectionInfo1 = createConnectionInfo();
    SessionInfo sessionInfo1 = createSessionInfo(connectionInfo1);
    ProducerInfo producerInfo = createProducerInfo(sessionInfo1);
    connection1.send(connectionInfo1);
    connection1.send(sessionInfo1);
    connection1.send(producerInfo);
    destination = createDestinationInfo(connection1, connectionInfo1, destinationType);
    ConsumerInfo consumerInfo1 = createConsumerInfo(sessionInfo1, destination);
    connection1.send(consumerInfo1);
    // Start a consumer on a remote broker using a proxy connection.
    StubConnection connection2 = createRemoteProxyConnection();
    ConnectionInfo connectionInfo2 = createConnectionInfo();
    SessionInfo sessionInfo2 = createSessionInfo(connectionInfo2);
    connection2.send(connectionInfo2);
    connection2.send(sessionInfo2);
    ConsumerInfo consumerInfo2 = createConsumerInfo(sessionInfo2, destination);
    connection2.send(consumerInfo2);
    // Either that or make consumer retroactive
    try {
        Thread.sleep(2000);
    } catch (Exception e) {
        e.printStackTrace();
    }
    // Send the message to the local broker.
    connection1.request(createMessage(producerInfo, destination, deliveryMode));
    // Verify that the message Was sent to the remote broker and the local
    // broker.
    Message m;
    m = receiveMessage(connection1);
    assertNotNull(m);
    assertNoMessagesLeft(connection1);
    m = receiveMessage(connection2);
    assertNotNull(m);
    assertNoMessagesLeft(connection2);
}
Also used : ProducerInfo(org.apache.activemq.command.ProducerInfo) ConsumerInfo(org.apache.activemq.command.ConsumerInfo) Message(org.apache.activemq.command.Message) StubConnection(org.apache.activemq.broker.StubConnection) SessionInfo(org.apache.activemq.command.SessionInfo) ConnectionInfo(org.apache.activemq.command.ConnectionInfo)

Aggregations

ProducerInfo (org.apache.activemq.command.ProducerInfo)95 ConnectionInfo (org.apache.activemq.command.ConnectionInfo)72 ConsumerInfo (org.apache.activemq.command.ConsumerInfo)72 SessionInfo (org.apache.activemq.command.SessionInfo)72 Message (org.apache.activemq.command.Message)69 ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)42 ActiveMQQueue (org.apache.activemq.command.ActiveMQQueue)18 XATransactionId (org.apache.activemq.command.XATransactionId)15 StubConnection (org.apache.activemq.broker.StubConnection)14 MessageAck (org.apache.activemq.command.MessageAck)14 ActiveMQTopic (org.apache.activemq.command.ActiveMQTopic)11 DataArrayResponse (org.apache.activemq.command.DataArrayResponse)9 TransactionInfo (org.apache.activemq.command.TransactionInfo)9 LocalTransactionId (org.apache.activemq.command.LocalTransactionId)8 Response (org.apache.activemq.command.Response)5 Test (org.junit.Test)5 IOException (java.io.IOException)4 ActiveMQMessage (org.apache.activemq.command.ActiveMQMessage)4 ActiveMQTextMessage (org.apache.activemq.command.ActiveMQTextMessage)4 TransactionId (org.apache.activemq.command.TransactionId)4