Package org.exolab.jms.client

Examples of org.exolab.jms.client.JmsTopic


                throw new RuntimeException("Failed to locate connection factory");
            }

            // create the topic. In reality the topic should be registered with JNDI
            // but this will do for now.
            Topic topic = new JmsTopic(topic_name);

            // get a topic connection to the factory.
            connection_ = factory.createTopicConnection();
           
            // set up the server session pool size to 15 and a message listener
View Full Code Here


                               boolean queue)
            throws PersistenceException {

        JmsDestination destination = (queue)
                ? (JmsDestination) new JmsQueue(name)
                : (JmsDestination) new JmsTopic(name);

        // create the destination. If the destination is also
        // a queue create a special consumer for it.
        try {
            _destinationLock.readLock().acquire();
View Full Code Here

        for (int i = 0; i < topics.length; ++i) {
            final AdministeredTopic topic = topics[i];
            final String name = topics[i].getName();

            if (_destinations.getDestination(name) == null) {
                final JmsTopic destination = new JmsTopic(name);
                destination.setPersistent(true);
                try {
                    _destinations.createDestination(destination);

                    // register the subscribers for each topic.
                    int scount = topic.getSubscriberCount();
View Full Code Here

            while (set.next()) {
                name = set.getString(1);
                isQueue = set.getBoolean(2);
                destination = (isQueue)
                        ? (JmsDestination) new JmsQueue(name)
                        : (JmsDestination) new JmsTopic(name);
                Id = set.getLong(3);
                destination.setPersistent(true);
                cache(destination, Id);
            }
        } catch (Exception exception) {
View Full Code Here

        try {
            _database.begin();
            // determine what type of consumer to create based on the destination
            // it subscribes to.
            if (destination instanceof JmsTopic) {
                JmsTopic topic = (JmsTopic) destination;
                consumer = new TopicConsumerEndpoint(consumerId, connectionId,
                                                     topic, selector, noLocal,
                                                     _destinations);
            } else if (destination instanceof JmsQueue) {
                QueueDestinationCache cache;
View Full Code Here

                String deststr = (String) map.get(consumer);

                JmsDestination dest = _destinations.getDestination(deststr);
                if (dest == null) {
                    // this maybe a wildcard subscription
                    dest = new JmsTopic(deststr);
                    if (!((JmsTopic) dest).isWildCard()) {
                        dest = null;
                    }
                }
View Full Code Here

     *         <code>destination</code>; otherwise <code>false</code>
     */
    public boolean canConsume(JmsDestination destination) {
        boolean result = false;
        if (destination instanceof JmsTopic) {
            JmsTopic topic = (JmsTopic) getDestination();
            if (!topic.isWildCard()) {
                result = super.canConsume(destination);
            } else {
                result = topic.match((JmsTopic) destination);
            }
        }
        return result;
    }
View Full Code Here

     * @param cache       the corresponding cache
     */
    public void cacheAdded(JmsDestination destination,
                           DestinationCache cache) {
        if (destination instanceof JmsTopic) {
            JmsTopic myTopic = (JmsTopic) getDestination();
            JmsTopic topic = (JmsTopic) destination;
            if (myTopic.match(topic) && !_caches.containsKey(topic)) {
                _caches.put(topic, cache);
                cache.addConsumer(this);
            }
        }
View Full Code Here

     * consumer may receive messages immediately.
     *
     * @throws JMSException for any JMS error
     */
    protected void init() throws JMSException {
        JmsTopic topic = (JmsTopic) getDestination();

        // register the endpoint with the destination
        if (topic.isWildCard()) {
            // if the topic is a wild card then we need to retrieve a
            // set of matching destination caches.
            _caches = _destinations.getTopicDestinationCaches(topic);
            // for each cache register this endpoint as a consumer of
            // it's messages. Before doing so register as a destination
View Full Code Here

     * @return boolean             true if successful
     */
    public boolean addDurableConsumer(String topic, String name) {
        boolean result = false;
        try {
            JmsTopic t = new JmsTopic(topic);
            t.setPersistent(true);
            _consumers.subscribe(t, name, null);
            result = true;
        } catch (JMSException exception) {
            _log.error("Failed to add durable consumer=" + name
                       + " for topic=" + topic, exception);
View Full Code Here

TOP

Related Classes of org.exolab.jms.client.JmsTopic

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.