-
-
Notifications
You must be signed in to change notification settings - Fork 8
Example send message
Dannes Wessels edited this page Mar 20, 2016
·
4 revisions
(:
: Example: send 10 JMS messages with a few message properties
:)
xquery version "3.0";
import module namespace messaging="http://exist-db.org/xquery/messaging"
at "java:org.exist.jms.xquery.MessagingModule";
(: Configuration for setting-up an JMS connection :)
let $jmsConfiguration :=
map {
"java.naming.factory.initial" := "org.apache.activemq.jndi.ActiveMQInitialContextFactory",
"java.naming.provider.url" := "tcp://localhost:61616",
"destination" := "dynamicQueues/eXistdb-messaging-example",
"connection-factory" := "ConnectionFactory"
}
(: JMS message properties :)
let $messageProperties :=
map {
"Su" := "Sunday",
"Mo" := xs:integer(1),
"Tu" := 2,
"We" := true(),
2 := "a",
"test" := (1,2,3,4,5), (: not transferred :)
"a" := xs:short(5)
}
return
(: Send 10 messages :)
for $i in (1 to 10)
(: The actual message payload :)
let $content := <data>{$i}</data>
return
(: Send message to the JMS broker :)
messaging:send( $content , $messageProperties, $jmsConfiguration )