地獄男爵之博客無限
BlogJava
首頁
新隨筆
聯系
聚合
管理
posts - 33, comments - 70, trackbacks - 0
ActiveMQ4.1 +Spring2.0的POJO JMS方案 擴展,以更加實用(基于ss).二
一:續一,說明一的可使用性。
<
amq:queue
id
="destination.report"
physicalName
="active.jms.report"
/>
<
amq:queue
id
="destination.point"
physicalName
="active.jms.point"
/>
queue : 隊列的名字 for 制造者.
感覺
org.springframework.jms.listener.DefaultMessageListenerContainer 做的不好,如果destination property能做一個可包含多個隊列,并且有選擇性的messageListener就好了,這樣就避免下面的監聽的尷尬了。呵呵
<!--
listener container,MDP無需實現接口
-->
<
bean
id
="fluxPerhourListenerContainer"
class
="org.springframework.jms.listener.DefaultMessageListenerContainer"
>
<
property
name
="connectionFactory"
ref
="jmsConnectionFactory"
/>
<
property
name
="destination"
ref
="destination.fluxPerhour"
/>
<
property
name
="messageListener"
ref
="messageListener"
/>
</
bean
>
<
bean
id
="fluxPerDayListenerContainer"
class
="org.springframework.jms.listener.DefaultMessageListenerContainer"
>
<
property
name
="connectionFactory"
ref
="jmsConnectionFactory"
/>
<
property
name
="destination"
ref
="destination.fluxPerday"
/>
<
property
name
="messageListener"
ref
="messageListener"
/>
</
bean
>
<
bean
id
="reportPerdayProducer"
class
="com.jms.ReportPerdayProducer"
>
<
property
name
="template"
ref
="jmsTemplate"
/>
<
property
name
="destination"
ref
="destination.report"
/>
</
bean
>
<
bean
id
="pointProducer"
class
="com.jms.PointProducer"
>
<
property
name
="template"
ref
="jmsTemplate"
/>
<
property
name
="destination"
ref
="destination.point"
/>
</
bean
>
producer不能重用,因為send到不同destination,所有沒辦法重用。
如果能對producer做一個默認統一的封裝就好了. 但是DefaultProducer.那么應該注意隊列線程安全方面,目前沒有什么好的想法,就采用通用一些的辦法,不過xml和代碼稍多一些.
然后就用到 前面文章一 里面的內容了,非常簡便。
<!--
Message Driven POJO (MDP)
-->
<
bean
id
="messageListener"
class
="org.springframework.jms.listener.adapter.MessageListenerAdapter"
>
<!--
may be other method
-->
<
constructor-arg
>
<
bean
class
="com..jms.MessageConsumerAdapter"
>
<!--業務接口/業務門面-->
<
property
name
="transfersManager"
ref
="transfersManager"
/>
</
bean
>
</
constructor-arg
>
<!--
may be other method
-->
<
property
name
="defaultListenerMethod"
value
="receive"
/>
<!--
custom MessageConverter define
-->
<
property
name
="messageConverter"
ref
="messageConverter"
/>
</
bean
>
<!--
Holder Message converter
-->
<
bean
id
="messageConverter"
class
="com.jms.CoverterHolder"
>
<
property
name
="defaultMessageConverter"
>
<
bean
class
="com.jms.DefaultMessageConverter"
/>
</
property
>
</
bean
>
<!--
Spring JmsTemplate config
-->
<
bean
id
="jmsTemplate"
class
="org.springframework.jms.core.JmsTemplate"
>
<
property
name
="connectionFactory"
>
<!--
lets wrap in a pool to avoid creating a connection per send
-->
<
bean
class
="org.springframework.jms.connection.SingleConnectionFactory"
>
<
property
name
="targetConnectionFactory"
ref
="jmsConnectionFactory"
/>
</
bean
>
</
property
>
<
property
name
="messageConverter"
ref
="messageConverter"
/>
</
bean
>
二.單元測試有時加載 activemq的問題
1.這個可能和spring版本有關系,請采用比較穩定的版本。例如apache-activemq官方包里面提供的.
2.選擇 xml解析的問題,例如
public
abstract
class
SpringManagerTestCase
extends
AbstractTransactionalDataSourceSpringContextTests
{
public
SpringManagerTestCase()
{
System.setProperty(
"
javax.xml.parsers.DocumentBuilderFactory
"
,
"
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
"
);
System.setProperty(
"
javax.xml.parsers.SAXParserFactory
"
,
"
org.apache.xerces.jaxp.SAXParserFactoryImpl
"
);
System.setProperty(
"
javax.xml.transform.TransformerFactory
"
,
"
org.apache.xalan.processor.TransformerFactoryImpl
"
);
setDependencyCheck(
false
);
setDefaultRollback(
false
);
}
/** */
/**
* 配置Spring的配置文件的方法。
*
@see
org.springframework.test.AbstractDependencyInjectionSpringContextTests#getConfigLocations()
*/
protected
String[] getConfigLocations()
{
return
new
String[]
{
"
classpath:applicationContext-activemq-embedded.xml
"
}
;
}
}
三.為特殊的應用服務器,如resin ,也要選擇特定的xml解析器
在web.xml中配置增加
<
web-app
>
<!--
In order to be able to compatiable with Resin 2.1.x and 3.0.x,
both XML and XSLT have to be replaced.
If only xalan is included, Resin 2.1.x will fail but not 3.0.x.
Therefore the best way is to use the compatiable version of the
XML parser ans XSLT.
- Please refere to the following link for more detailed information.
- http://www.caucho.com/resin-3.0/xml/jaxp.xtp
-->
<!--
xml
-->
<
system-property
javax.xml.parsers.DocumentBuilderFactory
=
"org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"
/>
<
system-property
javax.xml.parsers.SAXParserFactory
=
"org.apache.xerces.jaxp.SAXParserFactoryImpl"
/>
<!--
xslt
-->
<
system-property
javax.xml.transform.TransformerFactory
=
"org.apache.xalan.processor.TransformerFactoryImpl"
/>
</
web-app
>
以上的以全部在實施中測試通過并且運行。大家可以方向使用和理解。如有疑問,相互交流.
posted on 2007-04-05 16:55
地獄男爵(hellboys)
閱讀(2822)
評論(0)
編輯
收藏
所屬分類:
編程語言(c/c++ java python sql ......)
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
優化MySQL數據庫性能的八種方法
ActiveMQ4.1 +Spring2.0的POJO JMS方案 擴展,以更加實用(基于ss).二
ActiveMQ4.1 +Spring2.0的POJO JMS方案 擴展,以更加實用(基于ss)
compass 中使用annatation 簡化配置
Compass - springside 中的應用
HTMLParser屬性解析
使用Lucene建立自己的搜索引擎初步(轉)
Copyright ©2025 地獄男爵(hellboys) Powered By:
博客園
模板提供:
滬江博客
<
2007年4月
>
日
一
二
三
四
五
六
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
隨筆分類
bash
vim(1)
系統綜合(12)
編程語言(c/c++ java python sql ......)(7)
隨筆(6)
隨筆檔案
2010年11月 (1)
2009年3月 (2)
2008年12月 (1)
2008年11月 (1)
2008年6月 (1)
2007年12月 (1)
2007年11月 (1)
2007年4月 (2)
2007年3月 (1)
2006年11月 (1)
2006年10月 (1)
2006年9月 (2)
2006年8月 (1)
2006年7月 (2)
2006年6月 (6)
2006年5月 (3)
2006年4月 (5)
2006年3月 (1)
文章檔案
2005年12月 (1)
相冊
SARA--以后LP的標準?
恍惚的美麗(2007年的五一)
連接
差沙
我以前blog地址
聰明的豬(cleverpig)
最新隨筆
1.?Open MacVim tabs from command-line
2.?優化MySQL數據庫性能的八種方法
3.?Hadoop分布式文件系統(HDFS)的安全隱患
4.?sssh v2.0 - 快速 ssh 登陸腳本
5.?mod_python在 RHEL/CentOs 64 位編譯上的問題
6.?我想應聘中國男子國家足球隊主教練一職
7.?Android中文文檔v0.1 beta低調發布,期待更多同學來參加review
8.?歡迎訪問Android中國
9.?ActiveMQ4.1 +Spring2.0的POJO JMS方案 擴展,以更加實用(基于ss).二
10.?ActiveMQ4.1 +Spring2.0的POJO JMS方案 擴展,以更加實用(基于ss)
搜索
最新評論
1.?re: Mysql 集群簡介和配置[未登錄]
@dustin
動不動就說不穩定,人家島國的有個很大很大的社交網站就是這么搞的。你有啥子證據說不穩定,服了你。
--菜鳥
2.?re: 約瑟夫環算法(循環鏈表解決)
評論內容較長,點擊標題查看
--527055685@qq.com
3.?re: 約瑟夫環算法(循環鏈表解決)[未登錄]
@huchuhan
看不懂
!
--Sky
4.?re: Mysql 集群簡介和配置
評論內容較長,點擊標題查看
--tmeper
5.?re: 約瑟夫環算法(循環鏈表解決)
哥們啥是鏈表?
--huchuhan
閱讀排行榜
1.?Mysql 集群簡介和配置(61959)
2.?約瑟夫環算法(循環鏈表解決)(13327)
3.?妙解網絡多臺dhcp引起的IP沖突 (5880)
4.?Compass - springside 中的應用(5419)
5.?mod_python在 RHEL/CentOs 64 位編譯上的問題(3648)
評論排行榜
1.?約瑟夫環算法(循環鏈表解決)(19)
2.?Compass - springside 中的應用(18)
3.?Mysql 集群簡介和配置(7)
4.?不要一輩子靠技術生存(7)
5.?我想應聘中國男子國家足球隊主教練一職(5)
主站蜘蛛池模板:
女人18毛片免费观看
|
亚洲毛片av日韩av无码
|
蜜桃传媒一区二区亚洲AV
|
亚洲成a人片在线观看老师
|
久久精品中文字幕免费
|
亚洲无线一二三四区
|
免费v片在线观看品善网
|
中文字幕免费不卡二区
|
亚洲日韩精品国产3区
|
亚洲国产日韩在线视频
|
免费无码AV电影在线观看
|
国产精品视频全国免费观看
|
亚洲AV无码久久
|
女人18特级一级毛片免费视频
|
a级毛片免费高清视频
|
亚洲一级特黄特黄的大片
|
亚洲午夜久久久久久久久久
|
免费国产黄线在线观看
|
99re6在线精品免费观看
|
亚洲AV无码成人网站在线观看
|
亚洲国产精品lv
|
久久久无码精品亚洲日韩软件
|
国产香蕉九九久久精品免费
|
99久久免费国产精精品
|
亚洲av乱码一区二区三区按摩
|
久久久综合亚洲色一区二区三区
|
免费在线看片网站
|
可以免费看黄的网站
|
a级毛片黄免费a级毛片
|
国产成人 亚洲欧洲
|
亚洲成年人电影在线观看
|
国产亚洲色视频在线
|
免费观看午夜在线欧差毛片
|
在线视频精品免费
|
秋霞人成在线观看免费视频
|
国产大片免费天天看
|
立即播放免费毛片一级
|
亚洲人成电影网站久久
|
亚洲视频一区二区三区
|
亚洲AV人无码激艳猛片
|
亚洲日本va中文字幕久久
|