private boolean alreadyKnown(SubscriptionKey key) { boolean known = false; known = ((TopicRegion) getTopicRegion()).durableSubscriptionExists(key); LOG.trace("Sub with key: {}, {} already registered", key, (known ? "": "not")); return known; }
protected Message[] getSubscriberMessages(SubscriptionView view) { ActiveMQDestination destination = getTopicDestination(view); if (destination != null) { Destination topic = getTopicRegion().getDestinationMap().get(destination); return topic.browse(); } else { LOG.warn("can't determine topic to browse for sub:" + view); return new Message[]{}; } }
protected void addInactiveSubscription(SubscriptionKey key, SubscriptionInfo info, Subscription subscription) { try { ConsumerInfo offlineConsumerInfo = subscription != null ? subscription.getConsumerInfo() : ((TopicRegion)getTopicRegion()).createInactiveConsumerInfo(info); ObjectName objectName = BrokerMBeanSupport.createSubscriptionName(brokerObjectName, info.getClientId(), offlineConsumerInfo); SubscriptionView view = new InactiveDurableSubscriptionView(this, brokerService, key.getClientId(), info, subscription); try { if (AsyncAnnotatedMBean.registerMBean(asyncInvokeService, mbeanTimeout, managementContext, view, objectName) != null) { registeredMBeans.add(objectName); } } catch (Throwable e) { LOG.warn("Failed to register MBean {}", key); LOG.debug("Failure reason: ", e); } inactiveDurableTopicSubscribers.put(objectName, view); subscriptionKeys.put(key, objectName); } catch (Exception e) { LOG.error("Failed to register subscription {}", info, e); } }
public void remove(SubscriptionView view, String messageId) throws Exception { ActiveMQDestination destination = getTopicDestination(view); if (destination != null) { final Destination topic = getTopicRegion().getDestinationMap().get(destination); final MessageAck messageAck = new MessageAck(); messageAck.setMessageID(new MessageId(messageId)); messageAck.setDestination(destination); topic.getMessageStore().removeMessage(brokerService.getAdminConnectionContext(), messageAck); // if sub is active, remove from cursor if (view.subscription instanceof DurableTopicSubscription) { final DurableTopicSubscription durableTopicSubscription = (DurableTopicSubscription) view.subscription; final MessageReference messageReference = new NullMessageReference(); messageReference.getMessage().setMessageId(messageAck.getFirstMessageId()); durableTopicSubscription.getPending().remove(messageReference); } } else { throw new IllegalStateException("can't determine topic for sub:" + view); } }
private boolean alreadyKnown(SubscriptionKey key) { boolean known = false; known = ((TopicRegion) getTopicRegion()).durableSubscriptionExists(key); LOG.trace("Sub with key: {}, {} already registered", key, (known ? "": "not")); return known; }
private boolean alreadyKnown(SubscriptionKey key) { boolean known = false; known = ((TopicRegion) getTopicRegion()).durableSubscriptionExists(key); LOG.trace("Sub with key: {}, {} already registered", key, (known ? "": "not")); return known; }
private boolean alreadyKnown(SubscriptionKey key) { boolean known = false; known = ((TopicRegion) getTopicRegion()).durableSubscriptionExists(key); if (LOG.isTraceEnabled()) { LOG.trace("Sub with key: " + key + ", " + (known ? "": "not") + " already registered"); } return known; }
private boolean alreadyKnown(SubscriptionKey key) { boolean known = false; known = ((TopicRegion) getTopicRegion()).durableSubscriptionExists(key); LOG.trace("Sub with key: {}, {} already registered", key, (known ? "": "not")); return known; }
protected Message[] getSubscriberMessages(SubscriptionView view) { ActiveMQDestination destination = getTopicDestination(view); if (destination != null) { Destination topic = getTopicRegion().getDestinationMap().get(destination); return topic.browse(); } else { LOG.warn("can't determine topic to browse for sub:" + view); return new Message[]{}; } }
protected Message[] getSubscriberMessages(SubscriptionView view) { ActiveMQDestination destination = getTopicDestination(view); if (destination != null) { Destination topic = getTopicRegion().getDestinationMap().get(destination); return topic.browse(); } else { LOG.warn("can't determine topic to browse for sub:" + view); return new Message[]{}; } }
protected Message[] getSubscriberMessages(SubscriptionView view) { ActiveMQDestination destination = getTopicDestination(view); if (destination != null) { Destination topic = getTopicRegion().getDestinationMap().get(destination); return topic.browse(); } else { LOG.warn("can't determine topic to browse for sub:" + view); return new Message[]{}; } }
protected void addInactiveSubscription(SubscriptionKey key, SubscriptionInfo info, Subscription subscription) { try { ConsumerInfo offlineConsumerInfo = subscription != null ? subscription.getConsumerInfo() : ((TopicRegion)getTopicRegion()).createInactiveConsumerInfo(info); ObjectName objectName = BrokerMBeanSupport.createSubscriptionName(brokerObjectName, info.getClientId(), offlineConsumerInfo); SubscriptionView view = new InactiveDurableSubscriptionView(this, brokerService, key.getClientId(), info, subscription); try { AsyncAnnotatedMBean.registerMBean(asyncInvokeService, mbeanTimeout, managementContext, view, objectName); registeredMBeans.add(objectName); } catch (Throwable e) { LOG.warn("Failed to register MBean {}", key); LOG.debug("Failure reason: ", e); } inactiveDurableTopicSubscribers.put(objectName, view); subscriptionKeys.put(key, objectName); } catch (Exception e) { LOG.error("Failed to register subscription {}", info, e); } }
protected void addInactiveSubscription(SubscriptionKey key, SubscriptionInfo info, Subscription subscription) { try { ConsumerInfo offlineConsumerInfo = subscription != null ? subscription.getConsumerInfo() : ((TopicRegion)getTopicRegion()).createInactiveConsumerInfo(info); ObjectName objectName = BrokerMBeanSupport.createSubscriptionName(brokerObjectName, info.getClientId(), offlineConsumerInfo); SubscriptionView view = new InactiveDurableSubscriptionView(this, brokerService, key.getClientId(), info, subscription); try { AsyncAnnotatedMBean.registerMBean(asyncInvokeService, mbeanTimeout, managementContext, view, objectName); registeredMBeans.add(objectName); } catch (Throwable e) { LOG.warn("Failed to register MBean {}", key); LOG.debug("Failure reason: ", e); } inactiveDurableTopicSubscribers.put(objectName, view); subscriptionKeys.put(key, objectName); } catch (Exception e) { LOG.error("Failed to register subscription {}", info, e); } }
protected void addInactiveSubscription(SubscriptionKey key, SubscriptionInfo info, Subscription subscription) { try { ConsumerInfo offlineConsumerInfo = subscription != null ? subscription.getConsumerInfo() : ((TopicRegion)getTopicRegion()).createInactiveConsumerInfo(info); ObjectName objectName = BrokerMBeanSupport.createSubscriptionName(brokerObjectName, info.getClientId(), offlineConsumerInfo); SubscriptionView view = new InactiveDurableSubscriptionView(this, brokerService, key.getClientId(), info, subscription); try { AsyncAnnotatedMBean.registerMBean(asyncInvokeService, mbeanTimeout, managementContext, view, objectName); registeredMBeans.add(objectName); } catch (Throwable e) { LOG.warn("Failed to register MBean {}", key); LOG.debug("Failure reason: ", e); } inactiveDurableTopicSubscribers.put(objectName, view); subscriptionKeys.put(key, objectName); } catch (Exception e) { LOG.error("Failed to register subscription {}", info, e); } }
public void remove(SubscriptionView view, String messageId) throws Exception { ActiveMQDestination destination = getTopicDestination(view); if (destination != null) { final Destination topic = getTopicRegion().getDestinationMap().get(destination); final MessageAck messageAck = new MessageAck(); messageAck.setMessageID(new MessageId(messageId)); messageAck.setDestination(destination); topic.getMessageStore().removeMessage(brokerService.getAdminConnectionContext(), messageAck); // if sub is active, remove from cursor if (view.subscription instanceof DurableTopicSubscription) { final DurableTopicSubscription durableTopicSubscription = (DurableTopicSubscription) view.subscription; final MessageReference messageReference = new NullMessageReference(); messageReference.getMessage().setMessageId(messageAck.getFirstMessageId()); durableTopicSubscription.getPending().remove(messageReference); } } else { throw new IllegalStateException("can't determine topic for sub:" + view); } }
public void remove(SubscriptionView view, String messageId) throws Exception { ActiveMQDestination destination = getTopicDestination(view); if (destination != null) { final Destination topic = getTopicRegion().getDestinationMap().get(destination); final MessageAck messageAck = new MessageAck(); messageAck.setMessageID(new MessageId(messageId)); messageAck.setDestination(destination); topic.getMessageStore().removeMessage(brokerService.getAdminConnectionContext(), messageAck); // if sub is active, remove from cursor if (view.subscription instanceof DurableTopicSubscription) { final DurableTopicSubscription durableTopicSubscription = (DurableTopicSubscription) view.subscription; final MessageReference messageReference = new NullMessageReference(); messageReference.getMessage().setMessageId(messageAck.getFirstMessageId()); durableTopicSubscription.getPending().remove(messageReference); } } else { throw new IllegalStateException("can't determine topic for sub:" + view); } }
public void remove(SubscriptionView view, String messageId) throws Exception { ActiveMQDestination destination = getTopicDestination(view); if (destination != null) { final Destination topic = getTopicRegion().getDestinationMap().get(destination); final MessageAck messageAck = new MessageAck(); messageAck.setMessageID(new MessageId(messageId)); messageAck.setDestination(destination); topic.getMessageStore().removeMessage(brokerService.getAdminConnectionContext(), messageAck); // if sub is active, remove from cursor if (view.subscription instanceof DurableTopicSubscription) { final DurableTopicSubscription durableTopicSubscription = (DurableTopicSubscription) view.subscription; final MessageReference messageReference = new NullMessageReference(); messageReference.getMessage().setMessageId(messageAck.getFirstMessageId()); durableTopicSubscription.getPending().remove(messageReference); } } else { throw new IllegalStateException("can't determine topic for sub:" + view); } }