org.apache.activemq.artemis.rest.queue.PostMessage

Here are the examples of the java api class org.apache.activemq.artemis.rest.queue.PostMessage taken from open source projects.

1. TopicDestinationsResource#createTopicResource()

View license
public TopicResource createTopicResource(String topicName, boolean defaultDurable, int timeoutSeconds, boolean duplicates) throws Exception {
    TopicResource topicResource = new TopicResource();
    topicResource.setTopicDestinationsResource(this);
    topicResource.setDestination(topicName);
    topicResource.setServiceManager(manager);
    SubscriptionsResource subscriptionsResource = new SubscriptionsResource();
    topicResource.setSubscriptions(subscriptionsResource);
    subscriptionsResource.setConsumerTimeoutSeconds(timeoutSeconds);
    subscriptionsResource.setServiceManager(manager);
    subscriptionsResource.setDestination(topicName);
    subscriptionsResource.setSessionFactory(manager.getConsumerSessionFactory());
    PushSubscriptionsResource push = new PushSubscriptionsResource();
    push.setDestination(topicName);
    push.setSessionFactory(manager.getConsumerSessionFactory());
    topicResource.setPushSubscriptions(push);
    PostMessage sender = null;
    if (duplicates) {
        sender = new PostMessageDupsOk();
    } else {
        sender = new PostMessageNoDups();
    }
    sender.setDefaultDurable(defaultDurable);
    sender.setDestination(topicName);
    sender.setSessionFactory(manager.getSessionFactory());
    sender.setPoolSize(manager.getProducerPoolSize());
    sender.setProducerTimeToLive(manager.getProducerTimeToLive());
    sender.setServiceManager(manager);
    sender.init();
    topicResource.setSender(sender);
    if (manager.getPushStore() != null) {
        push.setPushStore(manager.getPushStore());
        List<PushTopicRegistration> regs = manager.getPushStore().getByTopic(topicName);
        for (PushTopicRegistration reg : regs) {
            push.addRegistration(reg);
        }
    }
    getTopics().put(topicName, topicResource);
    topicResource.start();
    return topicResource;
}