jms

ActiveMQ简述

旧巷老猫 提交于 2020-01-16 22:58:58
概述 ActiveMQ是Apache所提供的一个开源的消息系统,全然採用Java来实现。因此。它能非常好地支持J2EE提出的JMS(Java Message Service,即Java消息服务)规范。 JMS是一组Java应用程序接口。它提供消息的创建、发送、读取等一系列服务。JMS提供了一组公共应用程序接口和响应的语法。相似于Java数据库的统一訪问接口JDBC,它是一种与厂商无关的API,使得Java程序能够与不同厂商的消息组件非常好地进行通信。 JMS支持两种消息发送和接收模型。一种称为P2P(Ponit to Point)模型。即採用点对点的方式发送消息。P2P模型是基于队列的,消息生产者发送消息到队列。消息消费者从队列中接收消息,队列的存在使得消息的异步传输称为可能,P2P模型在点对点的情况下进行消息传递时採用。 还有一种称为Pub/Sub(Publish/Subscribe,即公布-订阅)模型,公布-订阅模型定义了怎样向一个内容节点公布和订阅消息,这个内容节点称为topic(主题)。主题能够觉得是消息传递的中介,消息公布这将消息公布到某个主题,而消息订阅者则从主题订阅消息。主题使得消息的订阅者与消息的公布者互相保持独立。不须要进行接触就可以保证消息的传递,公布-订阅模型在消息的一对多广播时採用。 ActiveMQ的安装 下载最新的安装包apache-activemq-5

JMS【三】--ActiveMQ简单的HelloWorld实例

て烟熏妆下的殇ゞ 提交于 2020-01-16 22:49:26
第一篇博文 JMS【一】--JMS基本概念 ,我们介绍了JMS的两种消息模型:点对点和发布订阅模型,以及消息被消费的两个方式:同步和异步,JMS编程模型的对象,最后说了JMS的优点。 第二篇博文 JMS【二】--ActiveMQ简单介绍以及安装 ,我们介绍了消息中间件ActiveMQ,安装,启动,以及优缺点。 这篇博文,我们使用ActiveMQ为大家实现一种点对点的消息模型。如果你对点对点模型的认识较浅,可以看一下第一篇博文的介绍。 JMS其实并没有想象的那么高大上,看完这篇博文之后,你就知道什么叫简单,下面直接进入主题。 1、开发环境   我们使用的是ActiveMQ 5.11.1 Release的Windows版,官网最新版是ActiveMQ 5.12.0 Release,大家可以自行下载, 下载地址 。   需要注意的是,开发时候,要将apache-activemq-5.11.1-bin.zip解压缩后里面的activemq-all-5.11.1.jar包加入到classpath下面,这个包包含了所有jms接口api的实现。 2、搭建开发环境 建立项目 我们只需要建立一个java项目就可以了,导入jar包,项目截图:   点对点的消息模型,只需要一个消息生成者和消息消费者,下面我们编写代码。 编写生产者 1 package com.tgb.activemq; 2 3

jms message interceptor

ε祈祈猫儿з 提交于 2020-01-16 16:24:29
问题 Is there anyway to intercept messages going to/from a java app and an activeMQ queue? Any opensource utilities I can avail of? Thanks Damien 回答1: You can use aspect-oriented programming. But it does beg the question: why would you want to do this? Logging, monitoring, alerting? Those are all cross-cutting concerns that AOP can address. 来源: https://stackoverflow.com/questions/4114187/jms-message-interceptor

Complete Async web service communication - sender and receiver are not available same time

China☆狼群 提交于 2020-01-16 08:59:17
问题 Two systems are talking to each other through integration(Using apache-camel). Let say system A needs to submit a request to System B which has exposed a web service to receive data and integration is transforming data as per system B web service. In above scenario A and B has to be available same time and A will have to wait for response from B. I need to remove this dependency by putting queue at integration layer and with Async communication. Ex: <camel:route id="AtoIntegration"> <camel

NAT router blocking JMS messages

浪子不回头ぞ 提交于 2020-01-16 07:05:12
问题 I have an openjms-0-7-7 instance running on my cloud machine. The connection to the jms topic happens over tcp. I run the client application on my personal computer at home and I am able to send messages to the topic (which then get forwarded correctly to other listeners) but I am unable to receive messages. My PC is connected to the internet through a NAT router. I have tried to reproduce this issue using my university network and it all worked fine (there I am assigned my own external IP

What is a “transactional unit of work” in plain english?

陌路散爱 提交于 2020-01-16 01:14:11
问题 This question follows directly from a previous question of mine in SO. I am still unable to grok the concept of JMS sessions being used as a transactional unit of work . From the Java Message Service book : The QueueConnection object is used to create a JMS Session object (specifically, a Queue Session), which is the working thread and transactional unit of work in JMS. Unlike JDBC, which requires a connection for each transactional unit of work, JMS uses a single connection and multiple

Error while creating JMS configuration in wso2esb

倖福魔咒の 提交于 2020-01-15 13:43:48
问题 I'm using wso2esb4.7.0 and wso2mb-2.2.0. I wish to create jms proxy service using wso2mb. For this i have configured the wso2mb as well as wso2esb like : Wso2esb configuration : (changes in jndi.properties) # register some connection factories # connectionfactory.[jndiname] = [ConnectionURL] connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5673' connectionfactory.TopicConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist=

Error while creating JMS configuration in wso2esb

蹲街弑〆低调 提交于 2020-01-15 13:42:11
问题 I'm using wso2esb4.7.0 and wso2mb-2.2.0. I wish to create jms proxy service using wso2mb. For this i have configured the wso2mb as well as wso2esb like : Wso2esb configuration : (changes in jndi.properties) # register some connection factories # connectionfactory.[jndiname] = [ConnectionURL] connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5673' connectionfactory.TopicConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist=

JMS encoded message selector not matching when using special characters

对着背影说爱祢 提交于 2020-01-15 11:44:10
问题 I have 2 applications (client and server) using a request-reply pattern. The client sends a request to the server the message ID is set to something like this: ID=Hostname-52991-1357677886768-3:1:2:1:1 . Now the client has to listen to a message with a correlation ID set to the same value. Since the value contains special characters (:) I have to encode the value (using UTF-8). Sets the JMS Selector, which is an SQL 92 predicate that is used to filter messages within the broker. You may have

How to get Spring to wire my JmsComponent

限于喜欢 提交于 2020-01-15 07:56:33
问题 I am writing an application using Akka, Akka-Camel and Spring for configuration. The application needs to act as a standalone JMS client against a variety of application servers, to which end it needs to set up the JMS connection factory using JNDI. I'm testing this with jBoss. I have the same problem with jBoss 5 and 6 (this seems to be a client-side Spring problem, not related to jBoss). I am configuring the Spring beans with this xml: <beans xmlns="http://www.springframework.org/schema