Search in sources :

Example 6 with LocalTransactionId

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

the class BrokerTest method testTransactedAckWithPrefetchOfOne.

public void testTransactedAckWithPrefetchOfOne() throws Exception {
    // Setup a first connection
    StubConnection connection1 = createConnection();
    ConnectionInfo connectionInfo1 = createConnectionInfo();
    SessionInfo sessionInfo1 = createSessionInfo(connectionInfo1);
    ProducerInfo producerInfo1 = createProducerInfo(sessionInfo1);
    connection1.send(connectionInfo1);
    connection1.send(sessionInfo1);
    connection1.send(producerInfo1);
    destination = createDestinationInfo(connection1, connectionInfo1, destinationType);
    ConsumerInfo consumerInfo1 = createConsumerInfo(sessionInfo1, destination);
    consumerInfo1.setPrefetchSize(1);
    connection1.send(consumerInfo1);
    // Send the messages
    for (int i = 0; i < 4; i++) {
        Message message = createMessage(producerInfo1, destination, deliveryMode);
        connection1.send(message);
    }
    // Now get the messages.
    for (int i = 0; i < 4; i++) {
        // Begin the transaction.
        LocalTransactionId txid = createLocalTransaction(sessionInfo1);
        connection1.send(createBeginTransaction(connectionInfo1, txid));
        Message m1 = receiveMessage(connection1);
        assertNotNull(m1);
        MessageAck ack = createAck(consumerInfo1, m1, 1, MessageAck.STANDARD_ACK_TYPE);
        ack.setTransactionId(txid);
        connection1.send(ack);
        // Commit the transaction.
        connection1.send(createCommitTransaction1Phase(connectionInfo1, txid));
    }
    assertNoMessagesLeft(connection1);
}
Also used : ProducerInfo(org.apache.activemq.command.ProducerInfo) ConsumerInfo(org.apache.activemq.command.ConsumerInfo) Message(org.apache.activemq.command.Message) LocalTransactionId(org.apache.activemq.command.LocalTransactionId) SessionInfo(org.apache.activemq.command.SessionInfo) MessageAck(org.apache.activemq.command.MessageAck) ConnectionInfo(org.apache.activemq.command.ConnectionInfo)

Example 7 with LocalTransactionId

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

the class LocalTransactionIdTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    LocalTransactionId info = (LocalTransactionId) object;
    info.setValue(1);
    info.setConnectionId(createConnectionId("ConnectionId:1"));
}
Also used : LocalTransactionId(org.apache.activemq.command.LocalTransactionId)

Example 8 with LocalTransactionId

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

the class LocalTransactionIdTest method createObject.

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

Example 9 with LocalTransactionId

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

the class LocalTransactionIdTest method createObject.

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

Example 10 with LocalTransactionId

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

the class LocalTransactionIdTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    LocalTransactionId info = (LocalTransactionId) object;
    info.setValue(1);
    info.setConnectionId(createConnectionId("ConnectionId:1"));
}
Also used : LocalTransactionId(org.apache.activemq.command.LocalTransactionId)

Aggregations

LocalTransactionId (org.apache.activemq.command.LocalTransactionId)26 ConnectionInfo (org.apache.activemq.command.ConnectionInfo)8 ConsumerInfo (org.apache.activemq.command.ConsumerInfo)8 Message (org.apache.activemq.command.Message)8 ProducerInfo (org.apache.activemq.command.ProducerInfo)8 SessionInfo (org.apache.activemq.command.SessionInfo)8 ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)4 ActiveMQQueue (org.apache.activemq.command.ActiveMQQueue)4 MessageAck (org.apache.activemq.command.MessageAck)4 ArtemisBrokerWrapper (org.apache.activemq.broker.artemiswrapper.ArtemisBrokerWrapper)1