牛仔褲的夏天
JAVA是藍色的-
online
BlogJava
::
首頁
::
新隨筆
::
聯系
::
聚合
::
管理
::
30 隨筆 :: 5 文章 :: 15 評論 :: 0 Trackbacks
<
2006年3月
>
日
一
二
三
四
五
六
26
27
28
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
31
1
2
3
4
5
6
7
8
公告
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(1)
給我留言
查看公開留言
查看私人留言
隨筆分類
Java(5)
(rss)
Others(4)
(rss)
Struts & Hibernate(9)
(rss)
Tomcat & Weblogic(2)
(rss)
XML(2)
(rss)
貝貝的故事(8)
(rss)
隨筆檔案
2006年6月 (1)
2006年4月 (3)
2006年3月 (20)
2006年2月 (1)
2006年1月 (3)
2005年12月 (2)
文章檔案
2006年3月 (2)
2006年2月 (1)
2006年1月 (1)
2005年12月 (1)
連接
InputKing在線中文輸入
java錄像
面試題目
搜索
最新評論
1.?re: struts中<html:messages>標簽的使用
4年前寫的了,早忘記了
--luckyrobbie
2.?re: struts中<html:messages>標簽的使用
寫的很好就是沒用啊 我弄了好久它怎么都不出來..
--還在睡覺的幽靈
3.?re: 有關ant的faq
default.properties under ant source code
--thomas sabo charm
4.?re: struts中<html:messages>標簽的使用[未登錄]
kkk
--kkk
5.?re: struts中<html:messages>標簽的使用
hdfd
--nn
閱讀排行榜
1.?一個取到ResultSet后返回Iterator的例子(5454)
2.?struts中<html:messages>標簽的使用(2139)
3.?復習一遍aix操作(2023)
4.?Weblogic JMS 的配置和MDB的應用(聽課筆記)(1557)
5.?顯示結果集的標簽(1163)
評論排行榜
1.?一個取到ResultSet后返回Iterator的例子(6)
2.?struts中<html:messages>標簽的使用(4)
3.?學習 xpath 的2個網站(3)
4.?顯示結果集的標簽(1)
5.?打電話(0)
Weblogic JMS 的配置和MDB的應用(聽課筆記)
在JMS的Connection Factories 中新建一個連接工廠
在Stores中新建一個存儲空間,可以為jdbc或者file類型
在Servers中新建一個Server
展開剛才創建的DemoJMSServer,新建一個Destinations,其中有2種類型,queue:點對點方式,topic:廣播方式給所有的MDB
在jb中新建一個MDB,transaction type:bean ,Destination type:javax.jms.Queue,在Destination name中輸入剛才在weblogic的jms里面建立的目標名稱,Pool properties的Maximum pool size:10
在onMessage方法中加入代碼
public
?
void
?onMessage(Message?msg)
{?
try
?
{
??????TextMessage?TMS?
=
?(TextMessage)?msg;
??????String?a1?
=
?TMS.getText();
??????String?b1?
=
?a1;
??????System.out.println(
"
Message?getted?Is?:
"
?
+
?a1?
+
?
"
>>>>>>>>>>>OK
"
);
??????Context?context?
=
?
new
?InitialContext();
??????Object?ref?
=
?context.lookup(
"
Sess
"
);?
//session bean的本地接口
??????SessHome?sessHome?
=
?(SessHome)?PortableRemoteObject.narrow(ref,?SessHome.
class
);
??????sessHome.create().insTableAa11(a1,?b1);
??????
//
這是通過Session?Bean的insTableAa11調用EntityBean的ejbHomeEjbInsertAa11
??????
//
功能其是很簡單,插入Aa11表一條記錄(a1,a1)
????}
????
catch
?(Exception?ex)?
{
??????ex.printStackTrace();
????}
}
deploy這個消息驅動Bean
new一個MDBTestClient class
package
?bmpsessmdb;
import
?java.util.
*
;
import
?javax.jms.
*
;
import
?javax.naming.
*
;
public
?
class
?MDBTestClient?
{
????
public
?
final
?
static
?String
??????JNDI_FACTORY?
=
?
"
weblogic.jndi.WLInitialContextFactory
"
;
??
public
?
final
?
static
?String?URL?
=
?
"
t3://127.0.0.1:7001
"
;
??
private
?
static
?
final
?String?QUEUE_CONNECTION_FACTORY?
=
??????
"
DemoJMSConnectionFactory
"
;
??
private
?
static
?
final
?String?QUEUE?
=
?
"
DemoJMSQueue
"
;
??
private
?
static
?InitialContext?getInitialContext(String?url)?
throws
??????NamingException?
{
????Hashtable?env?
=
?
new
?Hashtable();
????env.put(Context.INITIAL_CONTEXT_FACTORY,?JNDI_FACTORY);
????env.put(Context.PROVIDER_URL,?url);
????
return
?
new
?InitialContext(env);
??}
??
public
?
static
?
void
?main(String[]?args)?
throws
?Exception?
{
????Context?ctx?
=
?getInitialContext(URL);
????QueueConnectionFactory?qConnFact?
=
????(QueueConnectionFactory)?ctx.lookup(QUEUE_CONNECTION_FACTORY);
????QueueConnection?qConn?
=
?qConnFact.createQueueConnection();
????QueueSession?qSess?
=
?qConn.createQueueSession(
false
,
??????????????????????????????????????????????????Session.AUTO_ACKNOWLEDGE);
????Queue?q?
=
?(Queue)?ctx.lookup(QUEUE);
????QueueSender?qSend?
=
?qSess.createSender(q);
????TextMessage?txtMsg?
=
?qSess.createTextMessage(
"
songtx3
"
);
????System.out.println(
"
Sending?a?message?to?queue
"
);
????qSend.send(txtMsg);
????
//
---------------------------------------------------------
//
????txtMsg?
=
?qSess.createTextMessage(
"
songtx4
"
);
????System.out.println(
"
Sending?a?message?to?queue
"
);
????qSend.send(txtMsg);
????
//
---------------------------------------------------------
//
????qConn.close();
????System.exit(
0
);
??}
}
運行測試,over
posted on 2006-03-23 14:51
luckyrobbie
閱讀(1557)
評論(0)
編輯
收藏
所屬分類:
Tomcat & Weblogic
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
Weblogic JMS 的配置和MDB的應用(聽課筆記)
Tomcat 和 Weblogic 中配置application的安全策略(聽課筆記)
Powered by:
BlogJava
Copyright © luckyrobbie
主站蜘蛛池模板:
鹰潭市
|
澳门
|
江源县
|
陆河县
|
桐城市
|
定结县
|
武威市
|
白河县
|
保山市
|
麻江县
|
阳西县
|
永嘉县
|
城市
|
安乡县
|
获嘉县
|
东平县
|
宁城县
|
岐山县
|
睢宁县
|
佛冈县
|
喀喇沁旗
|
阿勒泰市
|
尼木县
|
根河市
|
云浮市
|
呼图壁县
|
南丰县
|
宁蒗
|
通州区
|
泰安市
|
清丰县
|
炎陵县
|
福贡县
|
定兴县
|
克什克腾旗
|
阳朔县
|
清丰县
|
江源县
|
阳高县
|
六枝特区
|
华容县
|