KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > jms > TopicSession

javax.jms
Interface TopicSession

All Superinterfaces:
Runnable, Session
See Also:
Top Examples, Source Code, Connection.createSession(boolean, int), TopicConnection.createTopicSession(boolean, int), XATopicSession.getTopicSession()

public TopicSubscriber createDurableSubscriber(Topic topic,
                                               String name)
                                        throws JMSException
See Also:
InvalidDestinationException, Session
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public TopicSubscriber createDurableSubscriber(Topic topic,
                                               String name,
                                               String messageSelector,
                                               boolean noLocal)
                                        throws JMSException
See Also:
InvalidSelectorException, InvalidDestinationException, Session
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public TopicPublisher createPublisher(Topic topic)
                               throws JMSException
See Also:
InvalidDestinationException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[822]Create a msg with a file attachment
By Anonymous on 2004/06/29 14:18:58  Rate
TopicConnectionFactory tcf = null; 
 Topic topic = null; 
 TopicConnection topicConn = null; 
 TopicSession topicSess = null; 
 TopicPublisher topicPub = null; 
  
  
  
 Context ctx = null; 
 Hashtable ht = new Hashtable (  ) ; 
 ctx = new InitialContext ( ht ) ; 
  
  
  
 tcf =  ( TopicConnectionFactory )  ctx.lookup ( "A TOPIC FACTORY JNDI NAME" ) ; 
  
  
 topic =  ( Topic )  ctx.lookup ( "A TOPIC JNDI NAME" ) ; 
  
  
 topicConn = tcf.createTopicConnection (  ) ; 
  
  
 topicSess =  topicConn.createTopicSession ( false, Session.AUTO_ACKNOWLEDGE ) ; 
  
  
 topicPub = topicSess.createPublisher ( topic ) ; 
  
  
 topicConn.start (  ) ; 
  
  
 //pFile is a java.io.File object 
 // Create a msg with a file attachment 
 ObjectMessage msg = topicSess.createObjectMessage ( pFile ) ; 
 msg.setStringProperty ( "Property 1", "aaa" ) ; 
 msg.setBooleanProperty ( "Property 2", true ) ; 
 topicPub.publish ( msg ) ; 
  
  
  
 //some clean up here 
 


public TopicSubscriber createSubscriber(Topic topic)
                                 throws JMSException
See Also:
InvalidDestinationException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public TopicSubscriber createSubscriber(Topic topic,
                                        String messageSelector,
                                        boolean noLocal)
                                 throws JMSException
See Also:
InvalidSelectorException, InvalidDestinationException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public TemporaryTopic createTemporaryTopic()
                                    throws JMSException
See Also:
Session
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Topic createTopic(String topicName)
                  throws JMSException
See Also:
Session
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void unsubscribe(String name)
                 throws JMSException
See Also:
InvalidDestinationException, Session
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags