[rabbitmq-discuss] other transports besides TCP
Simon MacMullen
simon at rabbitmq.com
Tue Oct 15 10:08:36 BST 2013
Hi.
I compiled your code and it works for me. I had to provide the address
and port for the DatagramPacket, so you probably want to make sure those
are correct. Also make sure the packet is not being eaten by a firewall.
Cheers, Simon
On 15/10/2013 09:25, Jorg Eloy wrote:
> Hi Simon,
>
> Thanks for your reply, let me said that when I sent messages using UDP,
> these messages are bounded to the queue in the channel with this line of
> code:
> /channel.queueBind(q1, xnameRaw, "#");/
>
> When I'm using Wireshark, I can view these messages arriving to the
> broker but they didn't reach to the exchange.
>
> Why I'm using UDP instead of TCP is because I'm tried with AMQP to work
> with sensors and servers,
> where sensors enqueue messages using UDP due to the typical sensor data
> is redundant an some loss can be tolerated
> and the servers receive these messages using a channel protocol over
> TCP, The servers might use TCP to transport messages reliably.
>
> Thanks again.
>
>
> PD. Here I put some important lines of the code that I'm using actually
> to do this task.
>
> -------------------------------------------------------------------------
> / String xnameRaw = "UDP raw exchage for testing";
> String xtype = "x-udp";
>
> ConnectionFactory factory = new ConnectionFactory();
>
> Connection connection = factory.newConnection();
> Channel channel = connection.createChannel();
>
> factory.setHost(BROKERMQ);
> factory.setUsername("guest");
> factory.setPassword("guest");
> factory.setPort(PORT);
>
> Map<String, Object> declArgs = new HashMap<String, Object>();
>
> declArgs.put("ip", "0.0.0.0");
> declArgs.put("port", (short) PORT);
>
> channel.exchangeDeclare(xnameRaw, xtype, false, false, false,
> declArgs);
> String q1 = channel.queueDeclare().getQueue();
> channel.queueBind(q1, xnameRaw, "#");
>
> DatagramSocket u2 = new DatagramSocket();
> DatagraPacket pOutRaw = new DatagramPacket(message, message.length,
> address, PORT);
>
> u2.send(pOutRaw);
> channel.basicPublish(xnameRaw, routingKey, null, message);/
> -------------------------------------------------------------------------
>
>
>
> 2013/10/11 Simon MacMullen <simon at rabbitmq.com <mailto:simon at rabbitmq.com>>
>
> I'm afraid your message doesn't really give us much to go on, other
> than "it doesn't work".
>
> I suggest you try to break the problem down: when you send a UDP
> packet, can you see it reach the broker in wireshark? Can you see it
> go into a queue (bound to the UDP exchange with "#") in the
> management plugin? And so on.
>
> Also, out of interest, why do you want to use UDP instead of TCP?
>
> Cheers, Simon
>
> On 11/10/2013 10:27AM, Jorg Eloy wrote:
>
> Hi all,
> I'm looking another transport for AMQP in place of TCP,
> Nowadays, I'm trying work with UPD exchange of tonyg
> [https://github.com/tonyg/udp-__exchange
> <https://github.com/tonyg/udp-exchange>], with the plugin to
> rabbitmq, to
> get a similar scenario with publishers, consumers, queues and
> exchanges,
> But I can't get it.
>
> My actual situation is that:
> I send messages from the publisher to the exchange and these
> messages
> are not published, I can view in the web management tool how the
> delivery rate in the exchange is altered,
> I'm using basicPublish to publish the messages and
> QueueingConsumer to
> consume the messages, Also DatagramSockets and DatagramPackets
> to send
> and receive by UDP.
> But as I said before, these messages are don't received in the
> consumer.
> Including that I use the same routing keys in the messages and when
> I try sending messages directly to the queue created for the
> consumer,
> these messages arrive successfully
>
> Can someone know what is the error?
>
> Thanks in advance.
>
>
>
>
> --
> Simon MacMullen
> RabbitMQ, Pivotal
>
>
More information about the rabbitmq-discuss
mailing list