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


Java ConsumerInfo.setConsumerId方法代码示例

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


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

示例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("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

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

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

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