Search in sources :

Example 1 with AddressQueryImpl

use of org.apache.activemq.artemis.core.client.impl.AddressQueryImpl in project activemq-artemis by apache.

the class ActiveMQSessionContext method addressQuery.

@Override
public ClientSession.AddressQuery addressQuery(final SimpleString address) throws ActiveMQException {
    if (sessionChannel.supports(PacketImpl.SESS_BINDINGQUERY_RESP_V4, getServerVersion())) {
        Packet packet = sessionChannel.sendBlocking(new SessionBindingQueryMessage(address), PacketImpl.SESS_BINDINGQUERY_RESP_V4);
        SessionBindingQueryResponseMessage_V4 response = (SessionBindingQueryResponseMessage_V4) packet;
        return new AddressQueryImpl(response.isExists(), response.getQueueNames(), response.isAutoCreateQueues(), response.isAutoCreateAddresses(), response.isDefaultPurgeOnNoConsumers(), response.getDefaultMaxConsumers(), response.isDefaultExclusive(), response.isDefaultLastValue());
    } else if (sessionChannel.supports(PacketImpl.SESS_BINDINGQUERY_RESP_V3, getServerVersion())) {
        Packet packet = sessionChannel.sendBlocking(new SessionBindingQueryMessage(address), PacketImpl.SESS_BINDINGQUERY_RESP_V3);
        SessionBindingQueryResponseMessage_V3 response = (SessionBindingQueryResponseMessage_V3) packet;
        return new AddressQueryImpl(response.isExists(), response.getQueueNames(), response.isAutoCreateQueues(), response.isAutoCreateAddresses(), ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(), null, null);
    } else if (sessionChannel.supports(PacketImpl.SESS_BINDINGQUERY_RESP_V2, getServerVersion())) {
        Packet packet = sessionChannel.sendBlocking(new SessionBindingQueryMessage(address), PacketImpl.SESS_BINDINGQUERY_RESP_V2);
        SessionBindingQueryResponseMessage_V2 response = (SessionBindingQueryResponseMessage_V2) packet;
        return new AddressQueryImpl(response.isExists(), response.getQueueNames(), response.isAutoCreateQueues(), false, ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(), null, null);
    } else {
        Packet packet = sessionChannel.sendBlocking(new SessionBindingQueryMessage(address), PacketImpl.SESS_BINDINGQUERY_RESP);
        SessionBindingQueryResponseMessage response = (SessionBindingQueryResponseMessage) packet;
        return new AddressQueryImpl(response.isExists(), response.getQueueNames(), false, false, ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(), null, null);
    }
}
Also used : Packet(org.apache.activemq.artemis.core.protocol.core.Packet) AddressQueryImpl(org.apache.activemq.artemis.core.client.impl.AddressQueryImpl) SessionBindingQueryResponseMessage_V4(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage_V4) SessionBindingQueryResponseMessage_V2(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage_V2) SessionBindingQueryResponseMessage_V3(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage_V3) SessionBindingQueryResponseMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage) SessionBindingQueryMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionBindingQueryMessage)

Aggregations

AddressQueryImpl (org.apache.activemq.artemis.core.client.impl.AddressQueryImpl)1 Packet (org.apache.activemq.artemis.core.protocol.core.Packet)1 SessionBindingQueryMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionBindingQueryMessage)1 SessionBindingQueryResponseMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage)1 SessionBindingQueryResponseMessage_V2 (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage_V2)1 SessionBindingQueryResponseMessage_V3 (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage_V3)1 SessionBindingQueryResponseMessage_V4 (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage_V4)1