`

javax.jms.Connection createSession

    博客分类:
  • jms
 
阅读更多
createSession(paramA,paramB);

paramA 取值有 : true or false 表示是否支持事务
paramB 取值有:Session.AUTO_ACKNOWLEDGE,Session.CLIENT_ACKNOWLEDGE,DUPS_OK_ACKNOWLEDGE,SESSION_TRANSACTED
createSession(paramA,paramB); 

paramA是设置事务的,paramB设置acknowledgment mode
paramA设置为false时:paramB的值可为Session.AUTO_ACKNOWLEDGE,Session.CLIENT_ACKNOWLEDGE,DUPS_OK_ACKNOWLEDGE其中一个。
paramA设置为true时:paramB的值忽略, acknowledgment mode被jms服务器设置为SESSION_TRANSACTED 。
Session.AUTO_ACKNOWLEDGE为自动确认,客户端发送和接收消息不需要做额外的工作。
Session.CLIENT_ACKNOWLEDGE为客户端确认。客户端接收到消息后,必须调用javax.jms.Message的acknowledge方法。jms服务器才会删除消息。
DUPS_OK_ACKNOWLEDGE允许副本的确认模式。一旦接收方应用程序的方法调用从处理消息处返回,会话对象就会确认消息的接收;而且允许重复确认。在需要考虑资源使用时,这种模式非常有效。
分享到:
评论

相关推荐

    ActiveMQ测试Demo

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue("testQueue"); MessageProducer producer = session.createProducer(queue); TextMessage ...

    activeMQ点对点map消息

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue("myQueue"); MessageProducer producer = session.createProducer(queue); TextMessage ...

    ActiveMQ简单的HelloWorld实例

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue("HelloWorldQueue")) { MessageProducer producer = session.createProducer(queue); ...

    activeMQ 服务端客户端 java代码

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic("myTopic"); MessageProducer producer = session.createProducer(topic); TextMessage ...

    Activemq同时支持多个Topic类型通信,并且配置添加到服务里面方便管理

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic1 = session.createTopic("topic1"); Topic topic2 = session.createTopic("topic2"); MessageProducer producer...

    ActiveMQ的使用代码样例(异步邮件发送).zip

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // 创建目的地,这里可以是队列或主题,根据需求选择 Destination destination = session.createQueue("MailQueue"); // ...

    ActiveMQ环境搭建及实例详解的源码

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = session.createProducer(session.createQueue("TestQueue")); TextMessage message = session....

    JMS实例 实例源码 点对点 主题 同步异步

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue("MyQueue"); // 或 Topic topic = session.createTopic("MyTopic"); MessageProducer ...

    Jms基础知识整理创建消息 -> 发送消息 -> 接收消息 -> 读取消息 ()

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // 获取队列目的地 Queue queue = (Queue) context.lookup("queue/testQueue"); // 创建消息生产者 MessageProducer ...

    jms详解,介绍jms必备哟

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // 获取队列 Queue queue = (Queue) context.lookup("queueName"); // 创建消息生产者 MessageProducer producer = ...

    ActiveMQ系列(四)--------结合 Eclipse 操作(csdn)————程序.pdf

    session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); destination = session.createQueue("helloword-destination"); producer = session.createProducer(destination); ``` 最后,我们创建一个...

    ActiveMQ in Action

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); ``` ##### 会话(Session) `JMSSession`接口是一个单线程上下文,用于创建消息生产者、消费者以及消息本身。会话还可以提供事务...

    ActiveMQ_Demo

    session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); } catch (JMSException e) { e.printStackTrace(); } } public void getMessage(String disname){ try { Queue queue = ...

    activeMQ的java简单实例

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // 创建队列 Queue queue = session.createQueue("MyQueue"); // 创建生产者 MessageProducer producer = session.createProducer...

    基于WebSphere MQ发送消息的简单JMS实例

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue(queueName); MessageProducer producer = session.createProducer(queue)) { TextMessage ...

    JMS学习笔记(一)——JMS简介安装ActiveMQ

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue("MyQueue"); MessageProducer producer = session.createProducer(queue); TextMessage ...

    JMS-ActiveMQ入门实例

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // 获取或创建队列 Queue queue = session.createQueue("myQueue"); // 创建消息生产者 MessageProducer producer = session....

    ActiveMQ例子

    Queue queue = session.createQueue("exampleQueue"); // 创建Producer MessageProducer producer = session.createProducer(queue); // 创建TextMessage TextMessage message = session.createTextMessage(...

    基于JMS的分布式异构数据库间的数据同步

    session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE); // 创建主题 topic = (javax.jms.Topic) getInitialContext().lookup("InsertTopic"); // 创建消息生产者 producer = ...

    jms基本用法

    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // 创建队列 Queue queue = session.createQueue("MyQueue"); // 创建生产者 MessageProducer producer = session.createProducer...

Global site tag (gtag.js) - Google Analytics