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


Java ConsumerInfo.setSelector方法代码示例

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


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

示例1: createDemandSubscription

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
protected DemandSubscription createDemandSubscription(ConsumerInfo info) throws IOException {
    if (addToAlreadyInterestedConsumers(info)) {
        return null; // don't want this subscription added
    }
    //add our original id to ourselves
    info.addNetworkConsumerId(info.getConsumerId());

    if (info.isDurable()) {
        // set the subscriber name to something reproducible
        info.setSubscriptionName(getSubscriberName(info.getDestination()));
        // and override the consumerId with something unique so that it won't
        // be removed if the durable subscriber (at the other end) goes away
        info.setConsumerId(new ConsumerId(localSessionInfo.getSessionId(),
                           consumerIdGenerator.getNextSequenceId()));
    }
    info.setSelector(null);
    return doCreateDemandSubscription(info);
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:19,代码来源:DurableConduitBridge.java

示例2: createDurableSubscriber

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
@Override
public ObjectName createDurableSubscriber(String clientId, String subscriberName, String topicName,
                                          String selector) throws Exception {
    ConnectionContext context = new ConnectionContext();
    context.setBroker(safeGetBroker());
    context.setClientId(clientId);
    ConsumerInfo info = new ConsumerInfo();
    ConsumerId consumerId = new ConsumerId();
    consumerId.setConnectionId(clientId);
    consumerId.setSessionId(sessionIdCounter.incrementAndGet());
    consumerId.setValue(0);
    info.setConsumerId(consumerId);
    info.setDestination(new ActiveMQTopic(topicName));
    info.setSubscriptionName(subscriberName);
    info.setSelector(selector);
    Subscription subscription = safeGetBroker().addConsumer(context, info);
    safeGetBroker().removeConsumer(context, info);
    if (subscription != null) {
        return subscription.getObjectName();
    }
    return null;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:23,代码来源:BrokerView.java

示例3: createConnectionConsumer

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector, ServerSessionPool sessionPool, int maxMessages, boolean noLocal)
    throws JMSException {

    checkClosedOrFailed();
    ensureConnectionInfoSent();

    ConsumerId consumerId = createConsumerId();
    ConsumerInfo consumerInfo = new ConsumerInfo(consumerId);
    consumerInfo.setDestination(ActiveMQMessageTransformation.transformDestination(destination));
    consumerInfo.setSelector(messageSelector);
    consumerInfo.setPrefetchSize(maxMessages);
    consumerInfo.setNoLocal(noLocal);
    consumerInfo.setDispatchAsync(isDispatchAsync());

    // Allows the options on the destination to configure the consumerInfo
    if (consumerInfo.getDestination().getOptions() != null) {
        Map<String, String> options = new HashMap<String, String>(consumerInfo.getDestination().getOptions());
        IntrospectionSupport.setProperties(consumerInfo, options, "consumer.");
    }

    return new ActiveMQConnectionConsumer(this, sessionPool, consumerInfo);
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:23,代码来源:ActiveMQConnection.java

示例4: testSendingSmallMessage

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
public void testSendingSmallMessage() throws Exception {
   ConsumerInfo expected = new ConsumerInfo();
   expected.setSelector("Cheese");
   expected.setExclusive(true);
   expected.setExclusive(true);
   expected.setPrefetchSize(3456);

   try {
      LOG.info("About to send: " + expected);
      producer.oneway(expected);

      Command received = assertCommandReceived();
      assertTrue("Should have received a ConsumerInfo but was: " + received, received instanceof ConsumerInfo);
      ConsumerInfo actual = (ConsumerInfo) received;
      assertEquals("Selector", expected.getSelector(), actual.getSelector());
      assertEquals("isExclusive", expected.isExclusive(), actual.isExclusive());
      assertEquals("getPrefetchSize", expected.getPrefetchSize(), actual.getPrefetchSize());
   } catch (Exception e) {
      LOG.info("Caught: " + e);
      e.printStackTrace();
      fail("Failed to send to transport: " + e);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:24,代码来源:UdpTestSupport.java

示例5: createDemandSubscription

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
@Override
protected DemandSubscription createDemandSubscription(ConsumerInfo info) throws IOException {
    if (addToAlreadyInterestedConsumers(info)) {
        return null; // don't want this subscription added
    }
    //add our original id to ourselves
    info.addNetworkConsumerId(info.getConsumerId());
    info.setSelector(null);
    return doCreateDemandSubscription(info);
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:11,代码来源:ConduitBridge.java

示例6: createInactiveConsumerInfo

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
public ConsumerInfo createInactiveConsumerInfo(SubscriptionInfo info) {
    ConsumerInfo rc = new ConsumerInfo();
    rc.setSelector(info.getSelector());
    rc.setSubscriptionName(info.getSubscriptionName());
    rc.setDestination(info.getSubscribedDestination());
    rc.setConsumerId(createConsumerId());
    return rc;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:9,代码来源:TopicRegion.java

示例7: setSelector

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
@Override
public void setSelector(String selector) throws InvalidSelectorException {
    ConsumerInfo copy = info.copy();
    copy.setSelector(selector);
    BooleanExpression newSelector = parseSelector(copy);
    // its valid so lets actually update it now
    info.setSelector(selector);
    this.selectorExpression = newSelector;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:10,代码来源:AbstractSubscription.java

示例8: testSelectorSkipsMessages

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

      // Start a producer and consumer
      StubConnection connection = createConnection();
      ConnectionInfo connectionInfo = createConnectionInfo();
      SessionInfo sessionInfo = createSessionInfo(connectionInfo);
      ProducerInfo producerInfo = createProducerInfo(sessionInfo);
      connection.send(connectionInfo);
      connection.send(sessionInfo);
      connection.send(producerInfo);

      destination = createDestinationInfo(connection, connectionInfo, destinationType);

      ConsumerInfo consumerInfo = createConsumerInfo(sessionInfo, destination);
      consumerInfo.setSelector("JMSType='last'");
      connection.send(consumerInfo);

      Message message1 = createMessage(producerInfo, destination, deliveryMode);
      message1.setType("first");
      Message message2 = createMessage(producerInfo, destination, deliveryMode);
      message2.setType("last");
      connection.send(message1);
      connection.send(message2);

      // Use selector to skip first message.
      Message m = receiveMessage(connection);
      assertNotNull(m);
      assertEquals(m.getMessageId(), message2.getMessageId());
      connection.send(createAck(consumerInfo, m, 1, MessageAck.STANDARD_ACK_TYPE));
      connection.send(closeConsumerInfo(consumerInfo));

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

示例9: testRequestResponse

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
public void testRequestResponse() throws Exception {
   ConsumerInfo expected = new ConsumerInfo();
   expected.setSelector("Edam");
   expected.setResponseRequired(true);
   LOG.info("About to send: " + expected);
   Response response = (Response) producer.request(expected, 2000);

   LOG.info("Received: " + response);
   assertNotNull("Received a response", response);
   assertTrue("Should not be an exception", !response.isException());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:12,代码来源:UdpTransportUsingServerTest.java

示例10: 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

示例11: 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

示例12: 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

示例13: 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


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