/** * @author zuly * * following jms ptp domain, use an simple text message to test * * A jms ptp sender will following the steps below! * 1> get an ConnectionFactory use JNDI Lookup Or Initial it yourself * 2> use this ConnectionFactory to start a jms connection
* [spec to jms 1.1 apito get the main idea of it ] * 3> use connection to create a jms session * 4> get a queue destination / messege agent * 5> start the Producer[jms1.1 spec] by a session * 6> get messege Object or initial it yourself by implements the messegeor
* it's sub interfaces * 7> call sender or send it selfing * 8> finallized the connection object or it will throw a warning to you! * * @param messege * @throws NamingException * @throws JMSException */ public void sendingProcessing(String messege) throws NamingException, JMSException{ Context ctx = new InitialContext(); ConnectionFactory cf = (ConnectionFactory) ctx.lookup("java:JmsXA"); Connection conn = cf.createConnection(); Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination dest = (Queue) ctx.lookup("queue/A"); MessageProducer msgp = session.createProducer(dest); QueueSender sender = (QueueSender) msgp; TextMessage msg = session.createTextMessage(); msg.setText(messege);