/** * Un-marshal an object instance from the data input stream * * @param o the object to un-marshal * @param dataIn the data input stream to build the object from * @throws IOException */ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); DestinationInfo info = (DestinationInfo)o; info.setConnectionId((org.apache.activemq.command.ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setOperationType(dataIn.readByte()); info.setTimeout(looseUnmarshalLong(wireFormat, dataIn)); if (dataIn.readBoolean()) { short size = dataIn.readShort(); org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; for( int i=0; i < size; i++ ) { value[i] = (org.apache.activemq.command.BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } }
info.setDestination(destination); info.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE); ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destination); fireAdvisory(context, topic, info);
/** * Create the DestinationInfo object for the temporary destination. * * @param topic - if its true topic, else queue. * @return DestinationInfo * @throws JMSException */ protected ActiveMQTempDestination createTempDestination(boolean topic) throws JMSException { // Check if Destination info is of temporary type. ActiveMQTempDestination dest; if (topic) { dest = new ActiveMQTempTopic(info.getConnectionId(), tempDestinationIdGenerator.getNextSequenceId()); } else { dest = new ActiveMQTempQueue(info.getConnectionId(), tempDestinationIdGenerator.getNextSequenceId()); } DestinationInfo info = new DestinationInfo(); info.setConnectionId(this.info.getConnectionId()); info.setOperationType(DestinationInfo.ADD_OPERATION_TYPE); info.setDestination(dest); syncSendPacket(info); dest.setConnection(this); activeTempDestinations.put(dest, dest); return dest; }
/** * Un-marshal an object instance from the data input stream * * @param o the object to un-marshal * @param dataIn the data input stream to build the object from * @throws IOException */ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); DestinationInfo info = (DestinationInfo)o; info.setConnectionId((org.apache.activemq.command.ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setOperationType(dataIn.readByte()); info.setTimeout(looseUnmarshalLong(wireFormat, dataIn)); if (dataIn.readBoolean()) { short size = dataIn.readShort(); org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; for( int i=0; i < size; i++ ) { value[i] = (org.apache.activemq.command.BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } }
void deleteTemporaryDestination(ActiveMQTempDestination destination) { DestinationInfo info = new DestinationInfo(); info.setConnectionId(connectionId); info.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE); info.setDestination(destination); sendToActiveMQ(info, new ResponseHandler() { @Override public void onResponse(AmqpProtocolConverter converter, Response response) throws IOException { if (response.isException()) { Throwable exception = ((ExceptionResponse) response).getException(); LOG.debug("Error during temp destination removeal: {}", exception.getMessage()); } } }); }
@Override public void removeDestinationInfo(ConnectionContext context, DestinationInfo destInfo) throws Exception { super.removeDestinationInfo(context, destInfo); DestinationInfo info = destinations.remove(destInfo.getDestination()); if (info != null) { // ensure we don't modify (and loose/overwrite) an in-flight add advisory, so duplicate info = info.copy(); info.setDestination(destInfo.getDestination()); info.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE); ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destInfo.getDestination()); fireAdvisory(context, topic, info); ActiveMQTopic[] advisoryDestinations = AdvisorySupport.getAllDestinationAdvisoryTopics(destInfo.getDestination()); for (ActiveMQTopic advisoryDestination : advisoryDestinations) { try { next.removeDestination(context, advisoryDestination, -1); } catch (Exception expectedIfDestinationDidNotExistYet) { } } } }
/** * Un-marshal an object instance from the data input stream * * @param o the object to un-marshal * @param dataIn the data input stream to build the object from * @throws IOException */ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); DestinationInfo info = (DestinationInfo)o; info.setConnectionId((org.apache.activemq.command.ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setOperationType(dataIn.readByte()); info.setTimeout(looseUnmarshalLong(wireFormat, dataIn)); if (dataIn.readBoolean()) { short size = dataIn.readShort(); org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; for( int i=0; i < size; i++ ) { value[i] = (org.apache.activemq.command.BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } }
void deleteTemporaryDestination(ActiveMQTempDestination destination) { DestinationInfo info = new DestinationInfo(); info.setConnectionId(connectionId); info.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE); info.setDestination(destination); sendToActiveMQ(info, new ResponseHandler() { @Override public void onResponse(AmqpProtocolConverter converter, Response response) throws IOException { if (response.isException()) { Throwable exception = ((ExceptionResponse) response).getException(); LOG.debug("Error during temp destination removeal: {}", exception.getMessage()); } } }); }
@Override public void removeDestinationInfo(ConnectionContext context, DestinationInfo destInfo) throws Exception { super.removeDestinationInfo(context, destInfo); DestinationInfo info = destinations.remove(destInfo.getDestination()); if (info != null) { // ensure we don't modify (and loose/overwrite) an in-flight add advisory, so duplicate info = info.copy(); info.setDestination(destInfo.getDestination()); info.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE); ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destInfo.getDestination()); fireAdvisory(context, topic, info); ActiveMQTopic[] advisoryDestinations = AdvisorySupport.getAllDestinationAdvisoryTopics(destInfo.getDestination()); for (ActiveMQTopic advisoryDestination : advisoryDestinations) { try { next.removeDestination(context, advisoryDestination, -1); } catch (Exception expectedIfDestinationDidNotExistYet) { } } } }
/** * Un-marshal an object instance from the data input stream * * @param o the object to un-marshal * @param dataIn the data input stream to build the object from * @throws IOException */ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); DestinationInfo info = (DestinationInfo)o; info.setConnectionId((org.apache.activemq.command.ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setOperationType(dataIn.readByte()); info.setTimeout(looseUnmarshalLong(wireFormat, dataIn)); if (dataIn.readBoolean()) { short size = dataIn.readShort(); org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; for( int i=0; i < size; i++ ) { value[i] = (org.apache.activemq.command.BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } }
private void deleteDurableQueues(List<ActiveMQQueue> queues) { try { for (ActiveMQQueue queue : queues) { LOG.debug("Removing queue subscription for {} ",queue.getPhysicalName()); DestinationInfo removeAction = new DestinationInfo(); removeAction.setConnectionId(protocol.getConnectionId()); removeAction.setDestination(queue); removeAction.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE); protocol.sendToActiveMQ(removeAction, new ResponseHandler() { @Override public void onResponse(MQTTProtocolConverter converter, Response response) throws IOException { // ignore failures.. } }); } } catch (Throwable e) { LOG.warn("Could not delete the MQTT queue subscriptions.", e); } }
@Override public void removeDestinationInfo(ConnectionContext context, DestinationInfo destInfo) throws Exception { super.removeDestinationInfo(context, destInfo); DestinationInfo info = destinations.remove(destInfo.getDestination()); if (info != null) { // ensure we don't modify (and loose/overwrite) an in-flight add advisory, so duplicate info = info.copy(); info.setDestination(destInfo.getDestination()); info.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE); ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destInfo.getDestination()); fireAdvisory(context, topic, info); ActiveMQTopic[] advisoryDestinations = AdvisorySupport.getAllDestinationAdvisoryTopics(destInfo.getDestination()); for (ActiveMQTopic advisoryDestination : advisoryDestinations) { try { next.removeDestination(context, advisoryDestination, -1); } catch (Exception expectedIfDestinationDidNotExistYet) { } } } }
public void destroyDestination(ActiveMQDestination destination) throws JMSException { checkClosedOrFailed(); ensureConnectionInfoSent(); DestinationInfo info = new DestinationInfo(); info.setConnectionId(this.info.getConnectionId()); info.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE); info.setDestination(destination); info.setTimeout(0); syncSendPacket(info); }
private void deleteDurableQueues(List<ActiveMQQueue> queues) { try { for (ActiveMQQueue queue : queues) { LOG.debug("Removing queue subscription for {} ",queue.getPhysicalName()); DestinationInfo removeAction = new DestinationInfo(); removeAction.setConnectionId(protocol.getConnectionId()); removeAction.setDestination(queue); removeAction.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE); protocol.sendToActiveMQ(removeAction, new ResponseHandler() { @Override public void onResponse(MQTTProtocolConverter converter, Response response) throws IOException { // ignore failures.. } }); } } catch (Throwable e) { LOG.warn("Could not delete the MQTT queue subscriptions.", e); } }
/** * Un-marshal an object instance from the data input stream * * @param o the object to un-marshal * @param dataIn the data input stream to build the object from * @throws IOException */ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); DestinationInfo info = (DestinationInfo)o; info.setConnectionId((org.apache.activemq.command.ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setOperationType(dataIn.readByte()); info.setTimeout(looseUnmarshalLong(wireFormat, dataIn)); if (dataIn.readBoolean()) { short size = dataIn.readShort(); org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; for( int i=0; i < size; i++ ) { value[i] = (org.apache.activemq.command.BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } }
private void deleteDurableQueues(List<ActiveMQQueue> queues) { try { for (ActiveMQQueue queue : queues) { LOG.debug("Removing queue subscription for {} ",queue.getPhysicalName()); DestinationInfo removeAction = new DestinationInfo(); removeAction.setConnectionId(protocol.getConnectionId()); removeAction.setDestination(queue); removeAction.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE); protocol.sendToActiveMQ(removeAction, new ResponseHandler() { @Override public void onResponse(MQTTProtocolConverter converter, Response response) throws IOException { // ignore failures.. } }); } } catch (Throwable e) { LOG.warn("Could not delete the MQTT queue subscriptions.", e); } }
/** * Un-marshal an object instance from the data input stream * * @param o the object to un-marshal * @param dataIn the data input stream to build the object from * @throws IOException */ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); DestinationInfo info = (DestinationInfo)o; info.setConnectionId((org.apache.activemq.command.ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setOperationType(dataIn.readByte()); info.setTimeout(looseUnmarshalLong(wireFormat, dataIn)); if (dataIn.readBoolean()) { short size = dataIn.readShort(); org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; for( int i=0; i < size; i++ ) { value[i] = (org.apache.activemq.command.BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } }
public void createDestination(String to) throws IOException, JMSException { ActiveMQDestination destination = createActiveMQDestination(to); if (destination == null) { LOG.debug("Unable to create destination for " + to); return; } subscribe(to, destination, jidToConsumerMap); // lets subscribe to a personal inbox for replies // Check if Destination info is of temporary type. if (inboxDestination == null) { inboxDestination = new ActiveMQTempQueue(connectionInfo.getConnectionId(), tempDestinationIdGenerator.getNextSequenceId()); DestinationInfo info = new DestinationInfo(); info.setConnectionId(connectionInfo.getConnectionId()); info.setOperationType(DestinationInfo.ADD_OPERATION_TYPE); info.setDestination(inboxDestination); sendToActiveMQ(info, null); subscribe(to, inboxDestination, jidToInboxConsumerMap); } }
/** * Un-marshal an object instance from the data input stream * * @param o the object to un-marshal * @param dataIn the data input stream to build the object from * @throws IOException */ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); DestinationInfo info = (DestinationInfo)o; info.setConnectionId((org.apache.activemq.command.ConnectionId)looseUnmarsalCachedObject(wireFormat, dataIn)); info .setDestination((org.apache.activemq.command.ActiveMQDestination)looseUnmarsalCachedObject( wireFormat, dataIn)); info.setOperationType(dataIn.readByte()); info.setTimeout(looseUnmarshalLong(wireFormat, dataIn)); if (dataIn.readBoolean()) { short size = dataIn.readShort(); org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (org.apache.activemq.command.BrokerId)looseUnmarsalNestedObject(wireFormat, dataIn); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } }
/** * Create the DestinationInfo object for the temporary destination. * * @param topic - if its true topic, else queue. * @return DestinationInfo * @throws JMSException */ protected ActiveMQTempDestination createTempDestination(boolean topic) throws JMSException { // Check if Destination info is of temporary type. ActiveMQTempDestination dest; if (topic) { dest = new ActiveMQTempTopic(info.getConnectionId(), tempDestinationIdGenerator.getNextSequenceId()); } else { dest = new ActiveMQTempQueue(info.getConnectionId(), tempDestinationIdGenerator.getNextSequenceId()); } DestinationInfo info = new DestinationInfo(); info.setConnectionId(this.info.getConnectionId()); info.setOperationType(DestinationInfo.ADD_OPERATION_TYPE); info.setDestination(dest); syncSendPacket(info); dest.setConnection(this); activeTempDestinations.put(dest, dest); return dest; }