001/*
002 * The contents of this file are subject to the license and copyright
003 * detailed in the LICENSE and NOTICE files at the root of the source
004 * tree.
005 */
006package org.fcrepo.jms;
007
008import javax.jms.Destination;
009import javax.jms.JMSException;
010
011/**
012 * Machinery to publish JMS messages when an EventBus
013 * message is received.
014 *
015 * @author barmintor
016 * @author awoods
017 */
018public class JMSTopicPublisher extends AbstractJMSPublisher {
019
020    private final String topicName;
021
022    /**
023     * Create a JMS Topic with the default name of "fedora"
024     */
025    public JMSTopicPublisher() {
026        this("fedora");
027    }
028
029    /**
030     * Create a JMS Topic with a configurable name
031     *
032     * @param topicName the name of the topic
033     */
034    public JMSTopicPublisher(final String topicName) {
035        this.topicName = topicName;
036    }
037
038    protected Destination createDestination() throws JMSException {
039        return jmsSession.createTopic(topicName);
040    }
041}