Skip to content

clz619/sinno-jms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sinno-jms

重新封装jms接口

提供activemq的实现:
快速支持ConnectionPool;
支持多种传输方式(http、tcp、stomp、nio)。

  String brokerURL = "failover:(nio://127.0.0.1:61608)";

  String queue = "que";
  IClientConfig clientConfig = new ActivemqClientPoolConfig();

  ActivemqClient client = ActivemqClientFactory.builder()
                .brokerURL(brokerURL)
                .clientConfig(clientConfig)
                .build();
  #消费者
  IQueueConsumer queueConsumer = client.createQueueConsumer(queue, new MessageListenerHolder(new MessageListener() {
      @Override
      public void onMessage(Message message) {
                try {
                    TextMessage txtMsg = (TextMessage) message;

                    LOG.info("consumer get msg:{}", new Object[]{txtMsg.getText()});
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
      }), 5);
      
   #生产者
  IQueueProducer queueProducer = client.createQueueProducer(queue, false, true, Session.AUTO_ACKNOWLEDGE);
  
   try {
        queueProducer.send("msg");
   } catch (Exception e) {
        e.printStackTrace();
   }

About

jms adapter client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages