Last active
August 29, 2015 14:15
-
-
Save steppat/360e979ba2541738d128 to your computer and use it in GitHub Desktop.
HornetQ com Stomp no Wildfly
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
1) https://github.com/leonardocordeiro/palestra-JMS-node | |
2) Precisa ter instalado o node. | |
3) No standalone-full.xml do Wildfly, no elemento <acceptors>: | |
<acceptor name="stomp-acceptor"> | |
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class> | |
<param key="protocol" value="STOMP"/> | |
<param key="port" value="61613"/> | |
</acceptor> | |
E no elemento <socket-binding-group>: | |
<socket-binding name="messaging-stomp" port="61614"/> | |
4) Para enviar uma mensagem com Stomp | |
---------------- | |
var tcp = require('net'); | |
var sys = require('sys'); | |
var localhost = "127.0.0.1"; | |
var conn = tcp.createConnection(61613, localhost); | |
conn.write("CONNECT\nlogin:caelum\npasscode:caelum\n\n\x00", function(){ | |
sys.puts('connected !!'); | |
}); | |
conn.write("SEND\ndestination:" + "jms.queue.FILA.GERADOR" + "\ncontent-type:text/plain\n\noi oi stomp\n\x00"); | |
----------- | |
5) Para receber uma mensagem com Stomp | |
-------------------------------- | |
var tcp = require('net'); | |
var sys = require('sys'); | |
var localhost = "127.0.0.1"; | |
var conn = tcp.createConnection(61613, localhost); | |
conn.write("CONNECT\nlogin:caelum\npasscode:caelum\n\n\x00", function(){ | |
sys.puts('connected !!'); | |
}); | |
conn.write("SUBSCRIBE\ndestination:" + "jms.queue.FILA.GERADOR\nACK:client\n\n\x00"); | |
conn.on("data", function(data) { | |
sys.puts(data); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment