Ejemplo n.º 1
0
 protected void unsubscribeCSAll(BrokerState brokerState) throws ClientException {
   if (!clientConfig.detailState)
     throw new ClientException(
         "unsubscribeCSAll() not supported with client.store_detail_state=OFF");
   MessageDestination clientDest =
       MessageDestination.formatClientDestination(
           clientID, brokerState.getBrokerAddress().getNodeURI());
   MessageSender msgSender = brokerState.getMsgSender();
   if (msgSender == null)
     throw new ClientException(
         "Connection not found for broker " + brokerState.getBrokerAddress());
   CompositeSubscriptionMessage[] csMsgArray =
       brokerState.getCSMessages().toArray(new CompositeSubscriptionMessage[0]);
   for (CompositeSubscriptionMessage csMsg : csMsgArray) {
     Uncompositesubscription unCS = new Uncompositesubscription(csMsg.getMessageID());
     UncompositesubscriptionMessage unCSMsg =
         new UncompositesubscriptionMessage(
             unCS, getNextMessageID(brokerState.getBrokerAddress().getNodeURI()), clientDest);
     try {
       msgSender.send(unCSMsg, HostType.CLIENT);
       brokerState.removeCSMsg(csMsg);
     } catch (CommunicationException e) {
       throw new ClientException(e.getMessage());
     }
   }
 }
Ejemplo n.º 2
0
 /**
  * Returns all the composite subscription messages the client has sent in the past. This method is
  * operational only when the store_detail_state option is switched ON.
  *
  * @return
  * @throws ClientException If the client.store_detail_state option is OFF
  */
 public Map<String, CompositeSubscriptionMessage> getCompositeSubscriptions()
     throws ClientException {
   if (!clientConfig.detailState)
     throw new ClientException(
         "getCompositeSubscriptions() not supported with client.store_detail_state=OFF");
   HashMap<String, CompositeSubscriptionMessage> idMsgMap =
       new HashMap<String, CompositeSubscriptionMessage>();
   for (BrokerState brokerState : brokerStates.values()) {
     Set<CompositeSubscriptionMessage> cSubs = brokerState.getCSMessages();
     for (CompositeSubscriptionMessage csMsg : cSubs) idMsgMap.put(csMsg.getMessageID(), csMsg);
   }
   return idMsgMap;
 }