All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.seam.jms.TopicSession Maven / Gradle / Ivy

There is a newer version: 3.2.26.ayg
Show newest version
package org.jboss.seam.jms;

import static org.jboss.seam.annotations.Install.BUILT_IN;

import javax.jms.JMSException;
import javax.jms.Session;
import javax.naming.NamingException;

import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Unwrap;
import org.jboss.seam.annotations.intercept.BypassInterceptors;

/**
 * Manager for a JMS TopicSession
 * 
 * @author Gavin King
 *
 */
@Scope(ScopeType.EVENT)
@BypassInterceptors
@Name("org.jboss.seam.jms.topicSession")
@Install(precedence = BUILT_IN, genericDependencies = ManagedTopicPublisher.class, dependencies = "org.jboss.seam.jms.topicConnection")
public class TopicSession {

	private javax.jms.TopicSession topicSession;
	
	public TopicSession() {
		super();
	}

	@Create
	public void create() throws JMSException, NamingException {
		//TODO: i really want a transactional session!
		topicSession = TopicConnection.instance().createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
	}

	@Destroy
	public void destroy() throws JMSException {
		topicSession.close();
	}

	@Unwrap
	public javax.jms.TopicSession getTopicSession() {
		return topicSession;
	}

	public static javax.jms.TopicSession instance() {
		return (javax.jms.TopicSession) Component.getInstance(TopicSession.class);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy