JMS Send and Receive in BPM studio

//1. create External Resource to represent the J2EE container:
// 1.1 new External Resources, name is "weblogicJ2EE", type "J2EE Application Server"
// 1.2 select Support Type as "GENERIC_J2EE"
// 1.3 input the initial Context Factory: "weblogic.jndi.WLInitialContextFactory"
// 1.4 input the URL: "t3://localhost:7001"

//2. create Enternal Recourse to represent the JMS service
// 2.1 new External Resource, name is "JMSReceive"
// 2.2 select type as "JMS Messaging Services"
// 2.3 select J2EE detail as "weblogicJ2EE" (same name as the External Resource you created)
// 2.4 select Destination Type: "QUEUE"
// 2.5 input the Lookup Name: "weblogic.examples.jms.exampleQueue"
// 2.6 input the Connection Factory Lookup Name: "weblogic.examples.jms.QueueConnectionFactory"


//3 setup the Global Automatic as a JMS listen process
// 3.1 right click the Global automatic activity
// 3.2 choose "runtime", select Global Automatic Type : Automatic JMS listener
// 3.3 select "JMS configuration" to "JMSReceive" (the one you created in step 1)
// 3.4 choose the Acknowledgement mode : AUTO_ACKNOWLEDGE


//message sending method
msg as String = "Hello World"
jmsMsg as Fuego.Msg.JmsMessage

msg = "<?xml version=\"1.0\"?><Msg>" + msg + "</Msg></xml>"
jmsMsg = JmsMessage(type : JmsMessageType.TEXT)
jmsMsg.textValue = msg
sendMessage DynamicJMS
using configuration = "JMSReceive",
message = jmsMsg


//message receiving method
messageData as String
// Message is stored in message variable.
messageData = message.textValue;
logMessage "the incoming message from the JMS server is:" + messageData using severity = WARNING
return true
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,我可以为您提供一些关于Spring整合JMS(IBM)发送和接收消息的基本步骤: 1. 首先,您需要在Spring中配置JMS连接工厂和目标资源。可以使用Spring的JmsTemplate来发送和接收消息。 2. 接下来,您需要编写发送消息的代码。使用JmsTemplate的send()方法来发送消息。例如,以下代码可以向目标队列发送一条简单的文本消息: ``` @Autowired private JmsTemplate jmsTemplate; public void sendMessage(String message) { jmsTemplate.send("YourQueueName", session -> session.createTextMessage(message)); } ``` 3. 然后,您需要编写接收消息的代码。使用JmsTemplate的receive()方法来接收消息。例如,以下代码可以从目标队列接收一条简单的文本消息: ``` @Autowired private JmsTemplate jmsTemplate; public String receiveMessage() { TextMessage message = (TextMessage) jmsTemplate.receive("YourQueueName"); return message.getText(); } ``` 4. 最后,您需要在Spring配置文件中定义消息监听器,以便在消息到达时自动处理它们。例如,以下代码可以定义一个简单的消息监听器: ``` <bean id="jmsListener" class="com.yourcompany.JmsMessageListener"/> <jms:listener-container connection-factory="jmsConnectionFactory"> <jms:listener destination="YourQueueName" ref="jmsListener"/> </jms:listener-container> ``` 在这里,JmsMessageListener是您自己编写的用于处理消息的类。 这些是Spring整合JMS(IBM)发送和接收消息的基本步骤。当然,实际上还有很多细节需要处理,例如如何处理异常、如何配置IBM MQ等。但是,这应该可以为您提供一个良好的起点。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值