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


Java ConnectionContext.setClientId方法代码示例

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


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

示例1: createDurableSubscriber

import org.apache.activemq.broker.ConnectionContext; //导入方法依赖的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

示例2: destroy

import org.apache.activemq.broker.ConnectionContext; //导入方法依赖的package包/类
/**
 * Destroys the durable subscription so that messages will no longer be
 * stored for this subscription
 */
public void destroy() throws Exception {
    RemoveSubscriptionInfo info = new RemoveSubscriptionInfo();
    info.setClientId(clientId);
    info.setSubscriptionName(subscriptionInfo.getSubscriptionName());
    ConnectionContext context = new ConnectionContext();
    context.setBroker(broker);
    context.setClientId(clientId);
    brokerService.getBroker().removeSubscription(context, info);
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:14,代码来源:InactiveDurableSubscriptionView.java

示例3: destroy

import org.apache.activemq.broker.ConnectionContext; //导入方法依赖的package包/类
/**
 * Destroys the durable subscription so that messages will no longer be
 * stored for this subscription
 */
public void destroy() throws Exception {
    RemoveSubscriptionInfo info = new RemoveSubscriptionInfo();
    info.setClientId(clientId);
    info.setSubscriptionName(subscriptionName);
    ConnectionContext context = new ConnectionContext();
    context.setBroker(broker);
    context.setClientId(clientId);
    brokerService.getBroker().removeSubscription(context, info);
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:14,代码来源:DurableSubscriptionView.java

示例4: destroyDurableSubscriber

import org.apache.activemq.broker.ConnectionContext; //导入方法依赖的package包/类
@Override
public void destroyDurableSubscriber(String clientId, String subscriberName) throws Exception {
    RemoveSubscriptionInfo info = new RemoveSubscriptionInfo();
    info.setClientId(clientId);
    info.setSubscriptionName(subscriberName);
    ConnectionContext context = new ConnectionContext();
    context.setBroker(safeGetBroker());
    context.setClientId(clientId);
    brokerService.getBroker().removeSubscription(context, info);
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:11,代码来源:BrokerView.java

示例5: doDirectUnsubscribe

import org.apache.activemq.broker.ConnectionContext; //导入方法依赖的package包/类
public void doDirectUnsubscribe(boolean restart) throws Exception {
   createSubscriptions();
   createAdvisorySubscription();

   Thread.sleep(1000);
   assertCount(100, 0);

   if (restart) {
      restartBroker();
      createAdvisorySubscription();
      assertCount(100, 0);
   }

   for (int i = 0; i < 100; i++) {
      RemoveSubscriptionInfo info = new RemoveSubscriptionInfo();
      info.setClientId(getName());
      info.setSubscriptionName("SubsId" + i);
      ConnectionContext context = new ConnectionContext();
      context.setBroker(broker.getRegionBroker());
      context.setClientId(getName());
      broker.getBroker().removeSubscription(context, info);

      if (i % 20 == 0) {
         Thread.sleep(1000);
         assertCount(100 - i - 1, 0);
      }
   }

   assertCount(0, 0);

   if (restart) {
      restartBroker();
      createAdvisorySubscription();
      assertCount(0, 0);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:37,代码来源:DurableSubscriptionUnsubscribeTest.java


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