org.apache.activemq.artemis.core.server.BindingQueryResult

Here are the examples of the java api class org.apache.activemq.artemis.core.server.BindingQueryResult taken from open source projects.

1. MQTTRetainMessageManager#addRetainedMessagesToQueue()

View license
void addRetainedMessagesToQueue(SimpleString queueName, String address) throws Exception {
    // Queue to add the retained messages to
    Queue queue = session.getServer().locateQueue(queueName);
    // The address filter that matches all retained message queues.
    String retainAddress = MQTTUtil.convertMQTTAddressFilterToCoreRetain(address);
    BindingQueryResult bindingQueryResult = session.getServerSession().executeBindingQuery(new SimpleString(retainAddress));
    // Iterate over all matching retain queues and add the head message to the original queue.
    for (SimpleString retainedQueueName : bindingQueryResult.getQueueNames()) {
        Queue retainedQueue = session.getServer().locateQueue(retainedQueueName);
        synchronized (this) {
            Iterator<MessageReference> i = retainedQueue.iterator();
            if (i.hasNext()) {
                ServerMessage message = i.next().getMessage().copy(session.getServer().getStorageManager().generateID());
                queue.addTail(message.createReference(queue), true);
            }
        }
    }
}