1. 程式人生 > >Spring整合activeMq(一):點對點模式

Spring整合activeMq(一):點對點模式

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:util="http://www.springframework.org/schema/util"  
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
   
  	<!-- 配置連線工廠 -->
	<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
		<property name="brokerURL">
			<value>tcp://localhost:61616</value>
		</property>
	</bean>
	<!-- 配置jmsTemplate -->
	<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
		<property name="connectionFactory">
			<ref bean="connectionFactory" />
		</property>
	</bean>
	
	<!-- 配置destination -->
	<bean id="destination" class="org.apache.activemq.command.ActiveMQQueue">
		<constructor-arg index="0">
			<value>MessageQueue222</value>
		</constructor-arg>
	</bean>
	<!-- 配置監聽器1 -->
	<bean id="messageListener" class="com.books.activeMq.listener.MyListener"></bean>
	<bean id="messageListener2" class="com.books.activeMq.listener.MyListener"></bean>
	
	<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
		<property name="connectionFactory" ref="connectionFactory" />
		<property name="destination" ref="destination" />
		<property name="messageListener" ref="messageListener" />
	</bean>
	<!-- 配置監聽器2 -->
	<bean id="jmsContainer2" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
		<property name="connectionFactory" ref="connectionFactory" />
		<property name="destination" ref="destination" />
		<property name="messageListener" ref="messageListener2" />
	</bean>
	
	<bean id="TestPoMqSender" class="com.books.activeMq.sender.TestPoMqSender"></bean>
    
</beans>

相關推薦

Spring整合activeMq:模式

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.spring

SpringMVC+Hibernate+Spring整合例項

SpringMVC又一個漂亮的web框架,他與Struts2並駕齊驅,Struts出世早而佔據了一定優勢,我在部落格《整合例項》中做了一個簡單的例項,介紹了SSH1的基本搭建方式,Struts2是根據Struts1發展而來,部落格中就沒有貼SSH2的例子,只對比了下Struts1和Struts2異同,通過對

spring boot 整合 jpa -- 之基礎配置

spring boot 整合 jpa (二) – 之資料操作 https://blog.csdn.net/qq_41463655/article/details/82939560 spring boot 整合 jpa (三) – 之表關係對映 https://blog.csdn.ne

spring boot 整合 jpa

先建立 springboot 專案 pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:

Spring boot整合websocket----傳統註冊方式

修改配置類 @Configuration @EnableWebSocket public class WebSocketConfig implements WebSocketConfigurer{ @Override public void regist

Spring Boot-2.1.0整合Mybatis

1.首先匯入依賴 <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spri

淺談jms之通過spring整合activeMQ實現jms例項

上篇說到使用activemq 實現jms訊息服務 的例項,但是那個是沒有spring進行整合和管理的;其實spring完整提供對jms的支援,所以我們可以通過spring來管理整合activemq 實現jms訊息傳遞服務。 1.建立maven工程(我的專案都是通過maven

Spring+SpringMVC+Mybatis整合系列Maven安裝與配置

最近有專案要做,想著還是來寫一篇SSM搭建的文件吧!此搭建文件僅供參考! Spring+SpringMVC+Mybatis簡稱SSM,首先說明一下,由於搭建SSM的篇幅略長,如果放到一篇博文中,可能會給讀者感覺閱讀起來很吃力。其實,寫博文也需要解耦,長篇大論並

Spring整合ActiveMQtopic 詳細配置步驟

maven工程新增依賴<dependencies> <!-- Spring --> <dependency> <groupId>org.springframework</groupId>

使用TeamCity專案進行可持續整合管理

一、可持續整合管理 持續整合,CI:即Continuous integration。 可持續整合的概念是基於團隊(小組)協作開發而提出來的,為了提高團隊開發效率與降低整合風險(早發現,早解決。晚發現,解決更麻煩<1>),各種可持續整合的管理平臺應運而生,這

spring之註解概述

dsm 的人 src article service 優缺點 中一 auto 數據 Spring的核心是依賴註入(DI),而依賴註入的基礎是依賴信息的配置。這些配置稱之為元數據。在之前的的學習中。一直採用的是基於xml的配置,這些元數據配置在spring內部被註冊成為B

Myeclipse 6.5 整合SSH

ini http lib tro ise 9.png ont ext 顏色 Myeclipse 6.5 整合SSH(一) 最近小學期正在學習基於Myeclipse 的SSH整合,期間出現了各種各樣的問題。問題太多,後面會整理後陸續另開博文寫。因為發現老師教我們的過程與網上的

Spring學習筆記

分布式 ransac 解析 工具 files 分布 工廠 根據 使用 Spring學習筆記(一) 因為最近在看《Spring 技術內幕-深入解析Spring 架構與設計原理》,相當於做了個筆記,以及把自己理解的東西記錄下來。 Spring整體架構圖 1.Spring子項目

Spring Data 介紹

tin 可能 動態 javac 行高 spec 增加 核心概念 一個 簡介   Spring Data是什麽       Spring Data是一個用於簡化數據庫訪問,並支持雲服務的開源框架。其主要目標是使得對數據的訪問變得方便快捷 Spring Data JPA能幹什麽

Spring框架初識

持久層 容器 med int reat set map 要求 enter 新的 1. Spring框架概述 1.1 簡介 Spring是分層的Java SE/EE應用 full-stack輕量級開源框架,以IoC(Inverse Of Control

Spring aop學習整理(spring in action):了解AOP

進入 一起 table return 問題 匹配 核心 before cti   切面能幫助我們模塊化橫切關註點。簡而言之,橫切關註點可以被描述為影響應用多處的功能。例如,安全就是一個橫切關註點,應用中的許多方法都會涉及到安全規則。圖4.1直觀呈現了橫切關註點的概念。  

Spring-Boot學習

圖片 public ram turn tps bind 實現 file clas 入門實例 - HelloWorld File > New > Spring Starter Project 項目創建完成: 這樣就完成了項目的創建,下面我們

面向——初識

das 形參 定制 event dir 產生 bre 字符 blog 一、類的相關知識 1)初識類 聲明 def functionName(args): ‘函數文檔字符串‘ 函數體 ‘‘‘ class 類名: ‘類

ssm框架的整合搭建

這一 目的 cli src pri 發現 maven工程 crud 自我 一個轉行菜鳥半年多工作的開始學習歷程。。。。。。。。。。。。 我是自學,也是我的記錄,我學習的見證,如果你有幸看見,不要吐槽,不足之處請指點,相互學習,謝謝!! 請一起共勉!!!!!!!! 使用技術:

springboot整合Mybatis——入門

target 連接池 param 不支持 void 2.6 batis gpo onf 一、概述   1.先導     mybatis入門隨筆:http://www.cnblogs.com/jiangbei/p/6884641.html   2.引入依賴