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()); } } }
protected UncompositesubscriptionMessage unSubscribeCS(String csID, BrokerState brokerState) throws ClientException { try { Uncompositesubscription unCS = new Uncompositesubscription(csID); MessageDestination clientDest = MessageDestination.formatClientDestination( clientID, brokerState.getBrokerAddress().getNodeURI()); UncompositesubscriptionMessage unCSMsg = new UncompositesubscriptionMessage( unCS, getNextMessageID(brokerState.getBrokerAddress().getNodeURI()), clientDest); String msgID = brokerState.getMsgSender().send(unCSMsg, HostType.CLIENT); unCSMsg.setMessageID(msgID); if (clientConfig.detailState) brokerState.removeCSMsg(csID); return unCSMsg; } catch (CommunicationException e) { throw new ClientException(e.getMessage()); } }