当前位置: 首页>>代码示例>>Java>>正文


Java ConsumerInfo.setRetroactive方法代码示例

本文整理汇总了Java中org.apache.activemq.command.ConsumerInfo.setRetroactive方法的典型用法代码示例。如果您正苦于以下问题:Java ConsumerInfo.setRetroactive方法的具体用法?Java ConsumerInfo.setRetroactive怎么用?Java ConsumerInfo.setRetroactive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.activemq.command.ConsumerInfo的用法示例。


在下文中一共展示了ConsumerInfo.setRetroactive方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startBridge

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
/**
 * @throws IOException
 */
final void startBridge() throws IOException {
    connectionInfo = new ConnectionInfo();
    connectionInfo.setConnectionId(new ConnectionId(ID_GENERATOR.generateId()));
    connectionInfo.setClientId(clientId);
    localBroker.oneway(connectionInfo);
    remoteBroker.oneway(connectionInfo);

    sessionInfo = new SessionInfo(connectionInfo, 1);
    localBroker.oneway(sessionInfo);
    remoteBroker.oneway(sessionInfo);

    queueConsumerInfo = new ConsumerInfo(sessionInfo, 1);
    queueConsumerInfo.setDispatchAsync(dispatchAsync);
    queueConsumerInfo.setDestination(new ActiveMQQueue(destinationFilter));
    queueConsumerInfo.setPrefetchSize(prefetchSize);
    queueConsumerInfo.setPriority(ConsumerInfo.NETWORK_CONSUMER_PRIORITY);
    localBroker.oneway(queueConsumerInfo);

    producerInfo = new ProducerInfo(sessionInfo, 1);
    producerInfo.setResponseRequired(false);
    remoteBroker.oneway(producerInfo);

    if (connectionInfo.getClientId() != null) {
        topicConsumerInfo = new ConsumerInfo(sessionInfo, 2);
        topicConsumerInfo.setDispatchAsync(dispatchAsync);
        topicConsumerInfo.setSubscriptionName("topic-bridge");
        topicConsumerInfo.setRetroactive(true);
        topicConsumerInfo.setDestination(new ActiveMQTopic(destinationFilter));
        topicConsumerInfo.setPrefetchSize(prefetchSize);
        topicConsumerInfo.setPriority(ConsumerInfo.NETWORK_CONSUMER_PRIORITY);
        localBroker.oneway(topicConsumerInfo);
    }

    LOG.info("Network connection between {} and {} has been established.", localBroker, remoteBroker);
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:39,代码来源:ForwardingBridge.java

示例2: testCompositeConsume

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
public void testCompositeConsume() 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);

      // setup the composite consumer.
      ActiveMQDestination compositeDestination = ActiveMQDestination.createDestination("A,B", destinationType);
      ConsumerInfo consumerInfo1 = createConsumerInfo(sessionInfo1, compositeDestination);
      consumerInfo1.setRetroactive(true);
      consumerInfo1.setPrefetchSize(100);
      connection1.send(consumerInfo1);

      // Publish to the two destinations
      ActiveMQDestination destinationA = ActiveMQDestination.createDestination("A", destinationType);
      ActiveMQDestination destinationB = ActiveMQDestination.createDestination("B", destinationType);

      // Send a message to each destination .
      connection1.send(createMessage(producerInfo1, destinationA, deliveryMode));
      connection1.send(createMessage(producerInfo1, destinationB, deliveryMode));

      // The consumer should get both messages.
      for (int i = 0; i < 2; i++) {
         Message m1 = receiveMessage(connection1);
         assertNotNull(m1);
      }

      assertNoMessagesLeft(connection1);
      connection1.send(closeConnectionInfo(connectionInfo1));
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:36,代码来源:BrokerTest.java

示例3: populateObject

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
@Override
protected void populateObject(Object object) throws Exception {
   super.populateObject(object);
   ConsumerInfo info = (ConsumerInfo) object;
   info.setConsumerId(createConsumerId("ConsumerId:1"));
   info.setBrowser(true);
   info.setDestination(createActiveMQDestination("Destination:2"));
   info.setPrefetchSize(1);
   info.setMaximumPendingMessageLimit(2);
   info.setDispatchAsync(false);
   info.setSelector("Selector:3");
   info.setSubscriptionName("SubcriptionName:4");
   info.setNoLocal(true);
   info.setExclusive(false);
   info.setRetroactive(true);
   info.setPriority((byte) 1);

   {
      BrokerId value[] = new BrokerId[2];
      for (int i = 0; i < 2; i++) {
         value[i] = createBrokerId("BrokerPath:5");
      }
      info.setBrokerPath(value);
   }
   info.setAdditionalPredicate(createBooleanExpression("AdditionalPredicate:6"));
   info.setNetworkSubscription(false);
   info.setOptimizedAcknowledge(true);
   info.setNoRangeAcks(false);

}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:31,代码来源:ConsumerInfoTest.java

示例4: populateObject

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
@Override
protected void populateObject(Object object) throws Exception {
   super.populateObject(object);
   ConsumerInfo info = (ConsumerInfo) object;

   info.setConsumerId(createConsumerId("ConsumerId:1"));
   info.setBrowser(true);
   info.setDestination(createActiveMQDestination("Destination:2"));
   info.setPrefetchSize(1);
   info.setMaximumPendingMessageLimit(2);
   info.setDispatchAsync(false);
   info.setSelector("Selector:3");
   info.setSubscriptionName("SubscriptionName:4");
   info.setNoLocal(true);
   info.setExclusive(false);
   info.setRetroactive(true);
   info.setPriority((byte) 1);
   {
      BrokerId value[] = new BrokerId[2];
      for (int i = 0; i < 2; i++) {
         value[i] = createBrokerId("BrokerPath:5");
      }
      info.setBrokerPath(value);
   }
   info.setAdditionalPredicate(createBooleanExpression("AdditionalPredicate:6"));
   info.setNetworkSubscription(false);
   info.setOptimizedAcknowledge(true);
   info.setNoRangeAcks(false);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:30,代码来源:ConsumerInfoTest.java

示例5: tightUnmarshal

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
/**
 * Un-marshal an object instance from the data input stream
 * 
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs)
    throws IOException {
    super.tightUnmarshal(wireFormat, o, dataIn, bs);

    ConsumerInfo info = (ConsumerInfo)o;
    info.setConsumerId((org.apache.activemq.command.ConsumerId)tightUnmarsalCachedObject(wireFormat,
                                                                                         dataIn, bs));
    info.setBrowser(bs.readBoolean());
    info
        .setDestination((org.apache.activemq.command.ActiveMQDestination)tightUnmarsalCachedObject(
                                                                                                   wireFormat,
                                                                                                   dataIn,
                                                                                                   bs));
    info.setPrefetchSize(dataIn.readInt());
    info.setMaximumPendingMessageLimit(dataIn.readInt());
    info.setDispatchAsync(bs.readBoolean());
    info.setSelector(tightUnmarshalString(dataIn, bs));
    info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
    info.setNoLocal(bs.readBoolean());
    info.setExclusive(bs.readBoolean());
    info.setRetroactive(bs.readBoolean());
    info.setPriority(dataIn.readByte());

    if (bs.readBoolean()) {
        short size = dataIn.readShort();
        org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size];
        for (int i = 0; i < size; i++) {
            value[i] = (org.apache.activemq.command.BrokerId)tightUnmarsalNestedObject(wireFormat,
                                                                                       dataIn, bs);
        }
        info.setBrokerPath(value);
    } else {
        info.setBrokerPath(null);
    }
    info
        .setAdditionalPredicate((org.apache.activemq.filter.BooleanExpression)tightUnmarsalNestedObject(
                                                                                                        wireFormat,
                                                                                                        dataIn,
                                                                                                        bs));
    info.setNetworkSubscription(bs.readBoolean());
    info.setOptimizedAcknowledge(bs.readBoolean());
    info.setNoRangeAcks(bs.readBoolean());

}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:52,代码来源:ConsumerInfoMarshaller.java

示例6: looseUnmarshal

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
/**
 * Un-marshal an object instance from the data input stream
 * 
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
    super.looseUnmarshal(wireFormat, o, dataIn);

    ConsumerInfo info = (ConsumerInfo)o;
    info.setConsumerId((org.apache.activemq.command.ConsumerId)looseUnmarsalCachedObject(wireFormat,
                                                                                         dataIn));
    info.setBrowser(dataIn.readBoolean());
    info
        .setDestination((org.apache.activemq.command.ActiveMQDestination)looseUnmarsalCachedObject(
                                                                                                   wireFormat,
                                                                                                   dataIn));
    info.setPrefetchSize(dataIn.readInt());
    info.setMaximumPendingMessageLimit(dataIn.readInt());
    info.setDispatchAsync(dataIn.readBoolean());
    info.setSelector(looseUnmarshalString(dataIn));
    info.setSubscriptionName(looseUnmarshalString(dataIn));
    info.setNoLocal(dataIn.readBoolean());
    info.setExclusive(dataIn.readBoolean());
    info.setRetroactive(dataIn.readBoolean());
    info.setPriority(dataIn.readByte());

    if (dataIn.readBoolean()) {
        short size = dataIn.readShort();
        org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size];
        for (int i = 0; i < size; i++) {
            value[i] = (org.apache.activemq.command.BrokerId)looseUnmarsalNestedObject(wireFormat, dataIn);
        }
        info.setBrokerPath(value);
    } else {
        info.setBrokerPath(null);
    }
    info
        .setAdditionalPredicate((org.apache.activemq.filter.BooleanExpression)looseUnmarsalNestedObject(
                                                                                                        wireFormat,
                                                                                                        dataIn));
    info.setNetworkSubscription(dataIn.readBoolean());
    info.setOptimizedAcknowledge(dataIn.readBoolean());
    info.setNoRangeAcks(dataIn.readBoolean());

}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:48,代码来源:ConsumerInfoMarshaller.java

示例7: testTopicRetroactiveConsumerSeeMessagesBeforeCreation

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
public void testTopicRetroactiveConsumerSeeMessagesBeforeCreation() throws Exception {

      ActiveMQDestination destination = new ActiveMQTopic("TEST");

      // Setup a first connection
      StubConnection connection1 = createConnection();
      ConnectionInfo connectionInfo1 = createConnectionInfo();
      connectionInfo1.setClientId("A");
      SessionInfo sessionInfo1 = createSessionInfo(connectionInfo1);
      ProducerInfo producerInfo1 = createProducerInfo(sessionInfo1);
      connection1.send(connectionInfo1);
      connection1.send(sessionInfo1);
      connection1.send(producerInfo1);

      // Send the messages
      Message m = createMessage(producerInfo1, destination, deliveryMode);
      connection1.send(m);

      // Create the durable subscription.
      ConsumerInfo consumerInfo1 = createConsumerInfo(sessionInfo1, destination);
      if (durableConsumer) {
         consumerInfo1.setSubscriptionName("test");
      }
      consumerInfo1.setPrefetchSize(100);
      consumerInfo1.setRetroactive(true);
      connection1.send(consumerInfo1);

      connection1.send(createMessage(producerInfo1, destination, deliveryMode));
      connection1.request(createMessage(producerInfo1, destination, deliveryMode));

      // the behavior is VERY dependent on the recovery policy used.
      // But the default broker settings try to make it as consistent as
      // possible

      // Subscription should see all messages sent.
      Message m2 = receiveMessage(connection1);
      assertNotNull(m2);
      assertEquals(m.getMessageId(), m2.getMessageId());
      for (int i = 0; i < 2; i++) {
         m2 = receiveMessage(connection1);
         assertNotNull(m2);
      }

      assertNoMessagesLeft(connection1);
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:46,代码来源:BrokerTest.java

示例8: testCompositeSend

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
public void testCompositeSend() 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);

      ActiveMQDestination destinationA = ActiveMQDestination.createDestination("A", destinationType);
      ConsumerInfo consumerInfo1 = createConsumerInfo(sessionInfo1, destinationA);
      consumerInfo1.setRetroactive(true);
      consumerInfo1.setPrefetchSize(100);
      connection1.request(consumerInfo1);

      // Setup a second connection
      StubConnection connection2 = createConnection();
      ConnectionInfo connectionInfo2 = createConnectionInfo();
      SessionInfo sessionInfo2 = createSessionInfo(connectionInfo2);
      connection2.send(connectionInfo2);
      connection2.send(sessionInfo2);

      ActiveMQDestination destinationB = ActiveMQDestination.createDestination("B", destinationType);
      ConsumerInfo consumerInfo2 = createConsumerInfo(sessionInfo2, destinationB);
      consumerInfo2.setRetroactive(true);
      consumerInfo2.setPrefetchSize(100);
      connection2.request(consumerInfo2);

      // Send the messages to the composite destination.
      ActiveMQDestination compositeDestination = ActiveMQDestination.createDestination("A,B", destinationType);
      for (int i = 0; i < 4; i++) {
         connection1.request(createMessage(producerInfo1, compositeDestination, deliveryMode));
      }

      // The messages should have been delivered to both the A and B
      // destination.
      for (int i = 0; i < 4; i++) {
         Message m1 = receiveMessage(connection1);
         Message m2 = receiveMessage(connection2);

         assertNotNull(m1);
         assertNotNull(m2);

         assertEquals(m1.getMessageId(), m2.getMessageId());
         assertEquals(compositeDestination, m1.getOriginalDestination());
         assertEquals(compositeDestination, m2.getOriginalDestination());

         connection1.request(createAck(consumerInfo1, m1, 1, MessageAck.STANDARD_ACK_TYPE));
         connection2.request(createAck(consumerInfo2, m2, 1, MessageAck.STANDARD_ACK_TYPE));

      }

      assertNoMessagesLeft(connection1);
      assertNoMessagesLeft(connection2);

      connection1.send(closeConnectionInfo(connectionInfo1));
      connection2.send(closeConnectionInfo(connectionInfo2));
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:61,代码来源:BrokerTest.java

示例9: testTopicNoLocal

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
public void testTopicNoLocal() throws Exception {

      ActiveMQDestination destination = new ActiveMQTopic("TEST");

      // 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);

      ConsumerInfo consumerInfo1 = createConsumerInfo(sessionInfo1, destination);
      consumerInfo1.setRetroactive(true);
      consumerInfo1.setPrefetchSize(100);
      consumerInfo1.setNoLocal(true);
      connection1.send(consumerInfo1);

      // Setup a second connection
      StubConnection connection2 = createConnection();
      ConnectionInfo connectionInfo2 = createConnectionInfo();
      SessionInfo sessionInfo2 = createSessionInfo(connectionInfo2);
      ProducerInfo producerInfo2 = createProducerInfo(sessionInfo2);
      connection2.send(connectionInfo2);
      connection2.send(sessionInfo2);
      connection2.send(producerInfo2);

      ConsumerInfo consumerInfo2 = createConsumerInfo(sessionInfo2, destination);
      consumerInfo2.setRetroactive(true);
      consumerInfo2.setPrefetchSize(100);
      consumerInfo2.setNoLocal(true);
      connection2.send(consumerInfo2);

      // Send the messages
      connection1.send(createMessage(producerInfo1, destination, deliveryMode));
      connection1.send(createMessage(producerInfo1, destination, deliveryMode));
      connection1.send(createMessage(producerInfo1, destination, deliveryMode));
      connection1.send(createMessage(producerInfo1, destination, deliveryMode));

      // The 2nd connection should get the messages.
      for (int i = 0; i < 4; i++) {
         Message m1 = receiveMessage(connection2);
         assertNotNull(m1);
      }

      // Send a message with the 2nd connection
      Message message = createMessage(producerInfo2, destination, deliveryMode);
      connection2.send(message);

      // The first connection should not see the initial 4 local messages sent
      // but should
      // see the messages from connection 2.
      Message m = receiveMessage(connection1);
      assertNotNull(m);
      assertEquals(message.getMessageId(), m.getMessageId());

      assertNoMessagesLeft(connection1);
      assertNoMessagesLeft(connection2);
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:61,代码来源:BrokerTest.java

示例10: testTopicDispatchIsBroadcast

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
public void testTopicDispatchIsBroadcast() throws Exception {

      ActiveMQDestination destination = new ActiveMQTopic("TEST");

      // 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);

      ConsumerInfo consumerInfo1 = createConsumerInfo(sessionInfo1, destination);
      consumerInfo1.setRetroactive(true);
      consumerInfo1.setPrefetchSize(100);
      connection1.send(consumerInfo1);

      // Setup a second connection
      StubConnection connection2 = createConnection();
      ConnectionInfo connectionInfo2 = createConnectionInfo();
      SessionInfo sessionInfo2 = createSessionInfo(connectionInfo2);
      ConsumerInfo consumerInfo2 = createConsumerInfo(sessionInfo2, destination);
      consumerInfo2.setRetroactive(true);
      consumerInfo2.setPrefetchSize(100);
      connection2.send(connectionInfo2);
      connection2.send(sessionInfo2);
      connection2.send(consumerInfo2);

      // Send the messages
      connection1.send(createMessage(producerInfo1, destination, deliveryMode));
      connection1.send(createMessage(producerInfo1, destination, deliveryMode));
      connection1.send(createMessage(producerInfo1, destination, deliveryMode));
      connection1.send(createMessage(producerInfo1, destination, deliveryMode));

      // Get the messages
      for (int i = 0; i < 4; i++) {
         Message m1 = receiveMessage(connection1);
         assertNotNull(m1);
         m1 = receiveMessage(connection2);
         assertNotNull(m1);
      }
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:44,代码来源:BrokerTest.java


注:本文中的org.apache.activemq.command.ConsumerInfo.setRetroactive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。