jms文章
来源:互联网 发布:阿部药妆 知乎 编辑:程序博客网 时间:2024/06/05 19:08
import java.util.Properties;
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
public class ThirdTest {
/**
* @param args
* @throws JMSException
*/
public static void main(String[] args) throws JMSException {
QueueConnection cnn = null;
QueueSender sender = null;
QueueSession sess = null;
Queue queue = null;
try {
Properties props = new Properties();
props.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.provider.url", "localhost:1099");
props.setProperty("java.naming.factory.url.pkgs",
"org.jboss.naming");
InitialContext ctx = new InitialContext(props);
QueueConnectionFactory factory = (QueueConnectionFactory) ctx
.lookup("ConnectionFactory");
cnn = factory.createQueueConnection();
sess = cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
queue = (Queue) ctx.lookup("queue/ejbMsgQueue");
} catch (Exception e) {
System.out.println(e.getMessage());
}
TextMessage msg = sess.createTextMessage("您好,这是我的第一个消息驱动Bean");
sender = sess.createSender(queue);
sender.send(msg);
sess.close();
System.out.println("消息已经发送出去了,你可以到JBoss控制台查看Bean的输出");
}
}
- jms文章
- JMS不错的文章
- 一篇文章理解JMS
- CEP 与 JMS 结合的参考文章
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- jms
- JMS
- 视图状态
- 自己加油~
- Java版SLG游戏《竜退治2》
- 查看VC6.0安装了SP x的补丁方法
- 机器人领头人
- jms文章
- 如何设置虚拟机下面的分辨率
- 利用flexbook,做的翻页特效
- 超喜欢交友!
- Zend framework1.9.3与数据库的连接
- Oracle SQL语句
- 合并GridView中某列相同信息的行
- 做最好的自己——摘自李镇西的《做最好的老师》
- How to pass data to a Flex application using SWFObject 2.0