/** * Quick method to stop listening for a heartbeat coming from the provider. * The registration to the service is handled by this class. For more * registrations, the developer is advised to use its own registration * mechanisms to the provider. * */ public void stopListening() { if (heartbeatSubscription != null) { try { IdentifierList ids = new IdentifierList(); ids.add(heartbeatSubscription.getSubscriptionId()); heartbeatService.beatDeregister(ids); } catch (MALInteractionException ex) { Logger.getLogger(HeartbeatConsumerServiceImpl.class.getName()).log(Level.SEVERE, null, ex); } catch (MALException ex) { Logger.getLogger(HeartbeatConsumerServiceImpl.class.getName()).log(Level.SEVERE, null, ex); } } }
void registerNotifyListener(final MessageDetails details, final Subscription subscription, final MALInteractionListener list) { final String uri = details.endpoint.getURI().getValue(); final String subId = subscription.getSubscriptionId().getValue(); final StringPair id = new StringPair(uri, subId); synchronized (notifyMap) { notifyMap.put(id, list); Map<String, MALInteractionListener> ent = errorMap.get(uri); if (null == ent) { ent = new HashMap<String, MALInteractionListener>(); errorMap.put(uri, ent); } MALContextFactoryImpl.LOGGER.log(Level.FINE, "PubSubMap({0}), adding notify handler: {1} : {2} : {3}", new Object[] { this, uri, subId, list }); ent.put(subId, list); } }
/** * Closes the tmConsumer connection * */ @Override public void closeConnection() { // Close old connection if (tmConsumer != null) { try { final IdentifierList subLst = new IdentifierList(); for (Subscription sub : subs) { subLst.add(sub.getSubscriptionId()); } if (eventService != null) { try { eventService.monitorEventDeregister(subLst); } catch (MALInteractionException ex) { Logger.getLogger(EventConsumerServiceImpl.class.getName()).log(Level.SEVERE, null, ex); } } tmConsumer.close(); } catch (MALException ex) { Logger.getLogger(ConsumerServiceImpl.class.getName()).log(Level.SEVERE, null, ex); } } }
@Override public void addSubscription(final MALMessageHeader srcHdr, final Subscription subscription) { final String subId = subscription.getSubscriptionId().getValue(); SimpleSubscriptionDetails sub = details.get(subId); if (null == sub) { sub = new SimpleSubscriptionDetails(subId); details.put(subId, sub); } sub.setIds(srcHdr, subscription.getEntities()); updateIds(); }
subLst.add(sub.getSubscriptionId());
subId = subscription.getSubscriptionId();
final String providerExchangeName = strURL.substring(iSecond + 1); String subscriptionKey = queueName + "::" + providerExchangeName + "::" + subscription.getSubscriptionId().getValue();