PubNub data stream publisher
Let's put together a quick publisher that reads the live stream of sensor data messages from the PubNub
and pushes them to RabbitMQ:
.. public class TestStream { private static final String EXCHANGE_NAME = "MYExchange"; private final static String QUEUE_NAME = "MYQueue"; private final static String ROUTING_KEY = "MYQueue"; private static void RMQPublisher(String myRecord) throws IOException, TimeoutException { ConnectionFactory factory = new ConnectionFactory(); Address[] addressArr = { new Address("localhost", 5672) }; Connection connection = factory.newConnection(addressArr); Channel channel = connection.createChannel(); channel.exchangeDeclare(EXCHANGE_NAME, "direct"); channel.queueDeclare(QUEUE_NAME, true, false, false, null); channel.queueBind(QUEUE_NAME, EXCHANGE_NAME, ROUTING_KEY); int i = 0; while (i < 1) { try { channel...