@Override public Subscription getSubscription() throws MALException { return (Subscription) getBodyElement(0, new Subscription()); } }
@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(); }
protected void internalHandleRegister(final GENMessage msg, Session lqs) throws MALException, MALInteractionException Subscription subscription = (Subscription) msg.getBody().getBodyElement(0, new Subscription()); final String strURL = msg.getHeader().getURITo().getValue(); final int iSecond = strURL.indexOf(JMSTransport.JMS_SERVICE_DELIM); final String providerExchangeName = strURL.substring(iSecond + 1); String subscriptionKey = queueName + "::" + providerExchangeName + "::" + subscription.getSubscriptionId().getValue();
/** * 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); } }
/** * * Returns a subscription object with the entity keys field set as the * provided keys * * @param subId Identifier of the subscription * @param key1 First key - name * @param key2 Second key - identity-id * @param key3 Third key - definition-id * @param key4 Fourth key - value-id * @return The subscription object */ private Subscription subscriptionKeys(Identifier subId, Identifier key1, Long key2, Long key3, Long key4) { final EntityKeyList entityKeys = new EntityKeyList(); final EntityKey entitykey = new EntityKey(key1, key2, key3, key4); entityKeys.add(entitykey); final EntityRequest entity = new EntityRequest(null, false, false, false, false, entityKeys); final EntityRequestList entities = new EntityRequestList(); entities.add(entity); return new Subscription(subId, entities); }
EntityRequestList entities = subscription.getEntities(); subId = subscription.getSubscriptionId();
/** * 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); } } }
/** * Returns a subscription object with the entity keys field set as the * provided keys * * @param subscriptionId The subscription Identifier * @param key1 First key * @param key2 Second key * @param key3 Third key * @param key4 Fourth key * @return The subscription object */ public static Subscription subscriptionKeys(final Identifier subscriptionId, final Identifier key1, final Long key2, final Long key3, final Long key4) { final EntityKeyList entityKeys = new EntityKeyList(); final EntityKey entitykey = new EntityKey(key1, key2, key3, key4); entityKeys.add(entitykey); final EntityRequest entity = new EntityRequest( null, false, false, false, false, entityKeys); final EntityRequestList entities = new EntityRequestList(); entities.add(entity); return new Subscription(subscriptionId, entities); }
subLst.add(sub.getSubscriptionId());
/** * * Returns a subscription object with the entity keys field set as the * provided keys * * @param subId Identifier of the subscription * @param key1 First key - event object number * @param key2 Second key - the area, service, and version ObjectType fields * as a MAL::Long * @param key3 Third key - the event object instance identifier. * @param key4 Fourth key - the area, service, version and number fields of * the event source ObjectType * @return The subscription object */ private Subscription subscriptionKeys(Identifier subId, Identifier key1, Long key2, Long key3, Long key4) { final EntityKeyList entityKeys = new EntityKeyList(); final EntityKey entitykey = new EntityKey(key1, key2, key3, key4); entityKeys.add(entitykey); final EntityRequest entity = new EntityRequest(null, false, false, false, false, entityKeys); final EntityRequestList entities = new EntityRequestList(); entities.add(entity); return new Subscription(subId, entities); }
/** * Returns a subscription object with wildcards in all four fields of the * entity keys field * * @param subscriptionId The subscription Identifier * @return The subscription object */ public static Subscription subscriptionWildcard(final Identifier subscriptionId) { final EntityKeyList entityKeys = new EntityKeyList(); final EntityKey entitykey = new EntityKey(new Identifier("*"), 0L, 0L, 0L); entityKeys.add(entitykey); final EntityRequest entity = new EntityRequest( null, false, false, false, false, entityKeys); final EntityRequestList entities = new EntityRequestList(); entities.add(entity); return new Subscription(subscriptionId, entities); }
return dec.decodeElement(new Subscription()); case MALPubSubOperation._PUBLISH_REGISTER_STAGE: return dec.decodeElement(new EntityKeyList());