July 28, 201411 yr SMLoadJar the main jar you get from http://www.apache.org/dyn/closer.cgi?path=/activemq/5.10.0/apache-activemq-5.10.0-bin.tar.gz And then here's the groovy code… RegisterGroovy( "sendToJMS( qURL ; qSubject ; qMessage )" ; "import javax.jms.*;¶ import org.apache.activemq.*;¶ ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(qURL);¶ Connection connection = connectionFactory.createConnection();¶ connection.start();¶ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);¶ Destination destination = session.createQueue(qSubject);¶ MessageProducer producer = session.createProducer(destination);¶ TextMessage message = session.createTextMessage(qMessage);¶ producer.send(message);¶ connection.close();¶ return true;"; "isGui=false" ) You get back '1'/true for success or 'ERROR' for a failure to post the message. Amazed about how easy that was to get done, and I'm just posting in case this is useful to anyone else. (It's entirely cribbed code from a java primer page I found online)
Create an account or sign in to comment