Search in sources :

Example 6 with QueueConsumer

use of org.apache.activemq.artemis.rest.queue.QueueConsumer in project activemq-artemis by apache.

the class SubscriptionsResource method createConsumer.

protected QueueConsumer createConsumer(boolean durable, boolean autoAck, String subscriptionName, String selector, long timeout, boolean deleteWhenIdle) throws ActiveMQException {
    QueueConsumer consumer;
    if (autoAck) {
        SubscriptionResource subscription = new SubscriptionResource(sessionFactory, subscriptionName, subscriptionName, serviceManager, selector, durable, timeout);
        subscription.setDurable(durable);
        subscription.setDeleteWhenIdle(deleteWhenIdle);
        consumer = subscription;
    } else {
        AcknowledgedSubscriptionResource subscription = new AcknowledgedSubscriptionResource(sessionFactory, subscriptionName, subscriptionName, serviceManager, selector, durable, timeout);
        subscription.setDurable(durable);
        subscription.setDeleteWhenIdle(deleteWhenIdle);
        consumer = subscription;
    }
    return consumer;
}
Also used : QueueConsumer(org.apache.activemq.artemis.rest.queue.QueueConsumer) AcknowledgedQueueConsumer(org.apache.activemq.artemis.rest.queue.AcknowledgedQueueConsumer)

Example 7 with QueueConsumer

use of org.apache.activemq.artemis.rest.queue.QueueConsumer in project activemq-artemis by apache.

the class SubscriptionsResource method internalHeadAutoAckSubscription.

private Response internalHeadAutoAckSubscription(UriInfo uriInfo, String consumerId) {
    QueueConsumer consumer = findAutoAckSubscription(consumerId);
    Response.ResponseBuilder builder = Response.noContent();
    String pathToPullSubscriptions = uriInfo.getMatchedURIs().get(1);
    headAutoAckSubscriptionResponse(uriInfo, consumer, builder, pathToPullSubscriptions);
    return builder.build();
}
Also used : Response(javax.ws.rs.core.Response) QueueConsumer(org.apache.activemq.artemis.rest.queue.QueueConsumer) AcknowledgedQueueConsumer(org.apache.activemq.artemis.rest.queue.AcknowledgedQueueConsumer) SimpleString(org.apache.activemq.artemis.api.core.SimpleString)

Example 8 with QueueConsumer

use of org.apache.activemq.artemis.rest.queue.QueueConsumer in project activemq-artemis by apache.

the class SubscriptionsResource method shutdown.

@Override
public void shutdown(String target) {
    QueueConsumer consumer = queueConsumers.get(target);
    if (consumer == null)
        return;
    shutdown(consumer);
}
Also used : QueueConsumer(org.apache.activemq.artemis.rest.queue.QueueConsumer) AcknowledgedQueueConsumer(org.apache.activemq.artemis.rest.queue.AcknowledgedQueueConsumer)

Aggregations

AcknowledgedQueueConsumer (org.apache.activemq.artemis.rest.queue.AcknowledgedQueueConsumer)8 QueueConsumer (org.apache.activemq.artemis.rest.queue.QueueConsumer)8 WebApplicationException (javax.ws.rs.WebApplicationException)3 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)3 Response (javax.ws.rs.core.Response)2 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)2 POST (javax.ws.rs.POST)1 UriBuilder (javax.ws.rs.core.UriBuilder)1 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)1