本文主要介紹weblogic jms的配置,包括JMS 服務(wù)器和JMS 模塊(連接工廠、隊(duì)列、遠(yuǎn)程 SAF 上下文、SAF 導(dǎo)入目的地、SAF 錯(cuò)誤處理)的配置;并在Spring環(huán)境下進(jìn)行消息的監(jiān)聽及發(fā)送;為了更多的使用webloigc jms的功能,發(fā)送的隊(duì)列使用saf配置的遠(yuǎn)程weblogic jms隊(duì)列(兩邊的weblogic版本須一致),當(dāng)然本地也是可以的。本文中demo所使用的軟件環(huán)境為:weblogic 10.3.6.0、spring5.1.2.RELEASE

注:saf配置的遠(yuǎn)程隊(duì)列只能發(fā)送消息,不能監(jiān)聽消息。
1、weblogic jms配置
1.1、配置JMS 服務(wù)器

注:需配置持久性存儲(chǔ),沒有就創(chuàng)建一個(gè)
1.2、配置JMS 模塊

下面的功能都是在JMS 模塊中配置;連接工廠、隊(duì)列、遠(yuǎn)程 SAF 上下文、SAF 導(dǎo)入目的地、SAF 錯(cuò)誤處理
這里就不一一截圖配置過程了,按頁面提示配置就行;配置結(jié)果如下

連接工廠需設(shè)置jndi,程序里會(huì)用到
SAF 遠(yuǎn)程上下文配置的遠(yuǎn)程地址及用戶名密碼信息
SAF 導(dǎo)入目的地配置的遠(yuǎn)程的隊(duì)列消息及對(duì)應(yīng)到本地的jndi
SAF 錯(cuò)誤處理程序配置錯(cuò)誤處理策略屬性,選配
隊(duì)列需設(shè)置jndi,程序里會(huì)用到
SAF 導(dǎo)入目的地配置的隊(duì)列消息如下:

點(diǎn)擊隊(duì)列名稱:

本地 JNDI 名稱程序里會(huì)用到,向該jndi發(fā)送消息實(shí)際會(huì)發(fā)送到遠(yuǎn)程的隊(duì)列里。
2、spring配置
增加applicationContext-jms.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-4.3.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-4.3.xsd">
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
<prop key="java.naming.provider.url">t3://10.39.196.10:7001</prop>
<prop key="java.naming.security.principal">weblogic</prop>
<prop key="java.naming.security.credentials">weblogic1</prop>
</props>
</property>
</bean>
<bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="proxyInterface" value="javax.jms.ConnectionFactory" />
<property name="jndiName" value="ConnectionFactory-test" />
</bean>
<bean id="testQueueSend" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="testQueueSend" />
<property name="jndiTemplate" ref="jndiTemplate" />
</bean>
<bean id="testQueueReceive" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="testQueue" />
<property name="jndiTemplate" ref="jndiTemplate" />
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="sender" class="com.inspur.demo.jms.Sender">
</bean>
<task:scheduled-tasks>
<task:scheduled ref="sender" method="hello" cron="0/5 * * * * ?" />
</task:scheduled-tasks>
<bean id="receiver" class="com.inspur.demo.jms.Receiver">
</bean>
<bean id="listenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="jmsConnectionFactory" />
<property name="destination" ref="testQueueReceive" />
<property name="messageListener" ref="receiver" />
<property name="autoStartup" value="true" />
</bean>
</beans>另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)建站chinadenli.net,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
本文題目:Spring整合Weblogicjms實(shí)例詳解-創(chuàng)新互聯(lián)
網(wǎng)頁網(wǎng)址:http://chinadenli.net/article26/dgpcjg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名、服務(wù)器托管、外貿(mào)建站、全網(wǎng)營銷推廣、電子商務(wù)、企業(yè)網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容