Created
September 12, 2014 04:09
-
-
Save welshstew/45aa6f42f847fce25593 to your computer and use it in GitHub Desktop.
send jms messages to activemq with a neat groovy script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab(group='org.apache.activemq',module = 'activemq-all', version='5.8.0') | |
import org.apache.activemq.ActiveMQConnectionFactory | |
import javax.jms.* | |
def brokerUrl = 'tcp://localhost:61616' | |
def queue = 'the.soapoverjms.service' | |
def soapAction = 'urn:sixtree:soapoverjms:dosomething' | |
def reader = new BufferedReader(new InputStreamReader(System.in)) | |
new ActiveMQConnectionFactory(brokerURL: brokerUrl).createConnection().with { | |
start() | |
createSession(false, Session.AUTO_ACKNOWLEDGE).with { | |
def message = createTextMessage(reader.text) | |
message.with { | |
jMSDeliveryMode = DeliveryMode.NON_PERSISTENT | |
jMSReplyTo = createTemporaryQueue() | |
jMSCorrelationID = UUID.randomUUID().toString() | |
setStringProperty('SOAPJMS_soapAction', soapAction) | |
} | |
createProducer().send(createQueue(queue), message) | |
} | |
close() | |
} | |
//run with | |
groovy jms.groovy < ~/Downloads/request.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/nfs/production/extsrv2/projects/local_work/wp-05/dev2/tools/groovy/lib/groovy-2.5.8.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
:: resolving dependencies :: caller#all-caller;working05
confs: [default]
validate = false
refresh = false
resolving dependencies for configuration 'default'
== resolving dependencies for caller#all-caller;working05 [default]
== resolving dependencies caller#all-caller;working05->org.apache.activemq#activemq-all;5.8.0 [default->default]
downloadGrapes: Checking cache for: dependency: org.apache.activemq#activemq-all;5.8.0 {default=[default]}
tried http://wwwint.ebi.ac.uk/wp/dev/artifactory/repo/org/apache/activemq/activemq-all/5.8.0/activemq-all-5.8.0.pom
tried http://wwwint.ebi.ac.uk/wp/dev/artifactory/repo/org/apache/activemq/activemq-all/5.8.0/activemq-all-5.8.0.jar
artifactory: no ivy file nor artifact found for org.apache.activemq#activemq-all;5.8.0
WARN: module not found: org.apache.activemq#activemq-all;5.8.0
WARN: ==== artifactory: tried
WARN: http://wwwint.ebi.ac.uk/wp/dev/artifactory/repo/org/apache/activemq/activemq-all/5.8.0/activemq-all-5.8.0.pom
WARN: -- artifact org.apache.activemq#activemq-all;5.8.0!activemq-all.jar:
WARN: http://wwwint.ebi.ac.uk/wp/dev/artifactory/repo/org/apache/activemq/activemq-all/5.8.0/activemq-all-5.8.0.jar
resolved ivy file produced in cache
:: downloading artifacts ::
resolve done (62ms resolve - 0ms download)
:: problems summary ::
:::: WARNINGS
module not found: org.apache.activemq#activemq-all;5.8.0
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
Error in resolve:
Error grabbing Grapes -- [unresolved dependency: org.apache.activemq#activemq-all;5.8.0: not found]
Perhaps the grape is not installed?