org.jboss.seam.jms.TopicSession Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jboss-seam Show documentation
Show all versions of jboss-seam Show documentation
Seam core module for Seam framework integrated with JSF2
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);
}
}