@Override public Map<String, String> getGroups() { Map<String,String> result = new HashMap<String,String>(); for (Map.Entry<String,ConsumerId>entry:map.entrySet()){ result.put(entry.getKey(),entry.getValue().toString()); } return result; }
@Override public synchronized Map<String, String> getGroups() { Map<String,String> result = new HashMap<String,String>(); for (Map.Entry<String,ConsumerId>entry: cache.entrySet()){ result.put(entry.getKey(),entry.getValue().toString()); } return result; }
public String getConsumerId() { return consumer != null ? consumer.getConsumerId().toString() : "NOT_SET"; }
public synchronized void put(String groupId, ConsumerId consumerId) { int bucket = getBucketNumber(groupId); consumers[bucket] = consumerId; if (consumerId != null){ cache.put(groupId,consumerId.toString()); } }
public TopicSubscription(Broker broker,ConnectionContext context, ConsumerInfo info, SystemUsage usageManager) throws Exception { super(broker, context, info); this.usageManager = usageManager; String matchedName = "TopicSubscription:" + CURSOR_NAME_COUNTER.getAndIncrement() + "[" + info.getConsumerId().toString() + "]"; if (info.getDestination().isTemporary() || broker.getTempDataStore()==null ) { this.matched = new VMPendingMessageCursor(false); } else { this.matched = new FilePendingMessageCursor(broker,matchedName,false); } this.scheduler = broker.getScheduler(); }
public static ObjectName createSubscriptionName(String brokerObjectName, String connectionClientId, ConsumerInfo info) throws MalformedObjectNameException { String objectNameStr = brokerObjectName; objectNameStr += createDestinationProperties(info.getDestination()) + ",endpoint=Consumer"; objectNameStr += ",clientId=" + JMXSupport.encodeObjectNamePart(connectionClientId); objectNameStr += ",consumerId="; if (info.isDurable()){ objectNameStr += "Durable(" + JMXSupport.encodeObjectNamePart(connectionClientId + ":" + info.getSubscriptionName()) +")"; } else { objectNameStr += JMXSupport.encodeObjectNamePart(info.getConsumerId().toString()); } return new ObjectName(objectNameStr); }
@Override public void slowConsumer(ConnectionContext context, Destination destination, Subscription subs) { super.slowConsumer(context, destination, subs); try { if (!AdvisorySupport.isAdvisoryTopic(destination.getActiveMQDestination())) { ActiveMQTopic topic = AdvisorySupport.getSlowConsumerAdvisoryTopic(destination.getActiveMQDestination()); ActiveMQMessage advisoryMessage = new ActiveMQMessage(); advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_CONSUMER_ID, subs.getConsumerInfo().getConsumerId().toString()); fireAdvisory(context, topic, subs.getConsumerInfo(), null, advisoryMessage); } } catch (Exception e) { handleFireFailure("slow consumer", e); } }
@Override public void messageDiscarded(ConnectionContext context, Subscription sub, MessageReference messageReference) { super.messageDiscarded(context, sub, messageReference); try { if (!messageReference.isAdvisory()) { BaseDestination baseDestination = (BaseDestination) messageReference.getMessage().getRegionDestination(); ActiveMQTopic topic = AdvisorySupport.getMessageDiscardedAdvisoryTopic(baseDestination.getActiveMQDestination()); Message payload = messageReference.getMessage().copy(); if (!baseDestination.isIncludeBodyForAdvisory()) { payload.clearBody(); } ActiveMQMessage advisoryMessage = new ActiveMQMessage(); if (sub instanceof TopicSubscription) { advisoryMessage.setIntProperty(AdvisorySupport.MSG_PROPERTY_DISCARDED_COUNT, ((TopicSubscription) sub).discarded()); } advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_MESSAGE_ID, payload.getMessageId().toString()); advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_CONSUMER_ID, sub.getConsumerInfo().getConsumerId().toString()); advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_DESTINATION, baseDestination.getActiveMQDestination().getQualifiedName()); fireAdvisory(context, topic, payload, null, advisoryMessage); } } catch (Exception e) { handleFireFailure("discarded", e); } }
@Override public Map<String, String> getGroups() { Map<String,String> result = new HashMap<String,String>(); for (Map.Entry<String,ConsumerId>entry:map.entrySet()){ result.put(entry.getKey(),entry.getValue().toString()); } return result; }
@Override public Map<String, String> getGroups() { Map<String,String> result = new HashMap<String,String>(); for (Map.Entry<String,ConsumerId>entry:map.entrySet()){ result.put(entry.getKey(),entry.getValue().toString()); } return result; }
@Override public Map<String, String> getGroups() { Map<String,String> result = new HashMap<String,String>(); for (Map.Entry<String,ConsumerId>entry:map.entrySet()){ result.put(entry.getKey(),entry.getValue().toString()); } return result; }
@Override public synchronized Map<String, String> getGroups() { Map<String,String> result = new HashMap<String,String>(); for (Map.Entry<String,ConsumerId>entry: cache.entrySet()){ result.put(entry.getKey(),entry.getValue().toString()); } return result; }
@Override public synchronized Map<String, String> getGroups() { Map<String,String> result = new HashMap<String,String>(); for (Map.Entry<String,ConsumerId>entry: cache.entrySet()){ result.put(entry.getKey(),entry.getValue().toString()); } return result; }
public synchronized void put(String groupId, ConsumerId consumerId) { int bucket = getBucketNumber(groupId); consumers[bucket] = consumerId; if (consumerId != null){ cache.put(groupId,consumerId.toString()); } }
public synchronized void put(String groupId, ConsumerId consumerId) { int bucket = getBucketNumber(groupId); consumers[bucket] = consumerId; if (consumerId != null){ cache.put(groupId,consumerId.toString()); } }
public TopicSubscription(Broker broker,ConnectionContext context, ConsumerInfo info, SystemUsage usageManager) throws Exception { super(broker, context, info); this.usageManager = usageManager; String matchedName = "TopicSubscription:" + CURSOR_NAME_COUNTER.getAndIncrement() + "[" + info.getConsumerId().toString() + "]"; if (info.getDestination().isTemporary() || broker.getTempDataStore()==null ) { this.matched = new VMPendingMessageCursor(false); } else { this.matched = new FilePendingMessageCursor(broker,matchedName,false); } this.scheduler = broker.getScheduler(); }
public TopicSubscription(Broker broker,ConnectionContext context, ConsumerInfo info, SystemUsage usageManager) throws Exception { super(broker, context, info); this.usageManager = usageManager; String matchedName = "TopicSubscription:" + CURSOR_NAME_COUNTER.getAndIncrement() + "[" + info.getConsumerId().toString() + "]"; if (info.getDestination().isTemporary() || broker.getTempDataStore()==null ) { this.matched = new VMPendingMessageCursor(false); } else { this.matched = new FilePendingMessageCursor(broker,matchedName,false); } this.scheduler = broker.getScheduler(); }
public static ObjectName createSubscriptionName(String brokerObjectName, String connectionClientId, ConsumerInfo info) throws MalformedObjectNameException { String objectNameStr = brokerObjectName; objectNameStr += createDestinationProperties(info.getDestination()) + ",endpoint=Consumer"; objectNameStr += ",clientId=" + JMXSupport.encodeObjectNamePart(connectionClientId); objectNameStr += ",consumerId="; if (info.isDurable()){ objectNameStr += "Durable(" + JMXSupport.encodeObjectNamePart(connectionClientId + ":" + info.getSubscriptionName()) +")"; } else { objectNameStr += JMXSupport.encodeObjectNamePart(info.getConsumerId().toString()); } return new ObjectName(objectNameStr); }
public static ObjectName createSubscriptionName(String brokerObjectName, String connectionClientId, ConsumerInfo info) throws MalformedObjectNameException { String objectNameStr = brokerObjectName; objectNameStr += createDestinationProperties(info.getDestination()) + ",endpoint=Consumer"; objectNameStr += ",clientId=" + JMXSupport.encodeObjectNamePart(connectionClientId); objectNameStr += ",consumerId="; if (info.isDurable()){ objectNameStr += "Durable(" + JMXSupport.encodeObjectNamePart(connectionClientId + ":" + info.getSubscriptionName()) +")"; } else { objectNameStr += JMXSupport.encodeObjectNamePart(info.getConsumerId().toString()); } return new ObjectName(objectNameStr); }
public static ObjectName createSubscriptionName(String brokerObjectName, String connectionClientId, ConsumerInfo info) throws MalformedObjectNameException { String objectNameStr = brokerObjectName; objectNameStr += createDestinationProperties(info.getDestination()) + ",endpoint=Consumer"; objectNameStr += ",clientId=" + JMXSupport.encodeObjectNamePart(connectionClientId); objectNameStr += ",consumerId="; if (info.isDurable()){ objectNameStr += "Durable(" + JMXSupport.encodeObjectNamePart(connectionClientId + ":" + info.getSubscriptionName()) +")"; } else { objectNameStr += JMXSupport.encodeObjectNamePart(info.getConsumerId().toString()); } return new ObjectName(objectNameStr); }