Example #1
0
 protected void unAdvertiseAll(BrokerState brokerState) throws ClientException {
   if (!clientConfig.detailState)
     throw new ClientException("unAdertiseAll() 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());
   AdvertisementMessage[] advMsgArray =
       brokerState.getAdvMessages().toArray(new AdvertisementMessage[0]);
   for (AdvertisementMessage advMsg : advMsgArray) {
     Unadvertisement unAdv = new Unadvertisement(advMsg.getMessageID());
     UnadvertisementMessage unAdvMsg =
         new UnadvertisementMessage(
             unAdv, getNextMessageID(brokerState.getBrokerAddress().getNodeURI()), clientDest);
     try {
       msgSender.send(unAdvMsg, HostType.CLIENT);
       brokerState.removeAdvMsg(advMsg);
     } catch (CommunicationException e) {
       throw new ClientException(e.getMessage());
     }
   }
 }
Example #2
0
 protected UnadvertisementMessage unAdvertise(String advID, BrokerState brokerState)
     throws ClientException {
   try {
     Unadvertisement unAdv = new Unadvertisement(advID);
     MessageDestination clientDest =
         MessageDestination.formatClientDestination(
             clientID, brokerState.getBrokerAddress().getNodeURI());
     UnadvertisementMessage unAdvMsg =
         new UnadvertisementMessage(
             unAdv, getNextMessageID(brokerState.getBrokerAddress().getNodeURI()), clientDest);
     String msgID = brokerState.getMsgSender().send(unAdvMsg, HostType.CLIENT);
     unAdvMsg.setMessageID(msgID);
     if (clientConfig.detailState) brokerState.removeAdvMsg(advID);
     return unAdvMsg;
   } catch (CommunicationException e) {
     throw new ClientException(e.getMessage());
   }
 }