List of usage examples for com.rabbitmq.client MessageProperties PERSISTENT_TEXT_PLAIN
BasicProperties PERSISTENT_TEXT_PLAIN
To view the source code for com.rabbitmq.client MessageProperties PERSISTENT_TEXT_PLAIN.
Click Source Link
From source file:stock84885customer.CustomerQueryController.java
private void sendQuery() throws IOException { queryChannel.basicPublish("", queryExchangeName, MessageProperties.PERSISTENT_TEXT_PLAIN, name.getBytes()); }
From source file:stock84885orderreceiver.OrderReceiverController.java
private void sendOrderResultToCustomer(String customerName, String result) throws IOException, TimeoutException { traceLogger.trace(name + " sending order result " + result + " to " + customerName); resultsChannel.basicPublish(resultsExchangeName, customerName, MessageProperties.PERSISTENT_TEXT_PLAIN, result.getBytes());//from w w w .ja va2 s .c o m }
From source file:stock84885orderreceiver.OrderReceiverController.java
private void sendOrderToShipping(Order order) throws IOException { traceLogger.trace(name + " sending order " + order.getID() + " to Shipping"); shippingChannel.basicPublish("", shippingExchangeName, MessageProperties.PERSISTENT_TEXT_PLAIN, order.serialize());/* w ww.j a v a2 s .c o m*/ }
From source file:stock84885queryhandler.QueryHandlerController.java
private void processQuery(String userName) throws IOException { List<Order> orders = this.orders.getOrdersByUserName(userName); String result = ""; if (!orders.isEmpty()) { for (int i = 0; i < orders.size() - 1; i++) { result += orders.get(i).toString() + FileSystemUtils.NEWLINE; }/*from w ww . j a v a 2s . c om*/ result += orders.get(orders.size() - 1).toString(); } //Send query result to user logger.trace(name + " sending query result " + result + " to " + userName); queriesResultsChannel.basicPublish(queriesResultsExchangeName, userName, MessageProperties.PERSISTENT_TEXT_PLAIN, result.getBytes()); }
From source file:stock84885shipping.ShippingController.java
private void deliverOrder(Order order) throws InterruptedException, IOException { Random random = new Random(); random.setSeed(System.nanoTime()); int delay = random.nextInt(maxOrderDeliveryDelay); Thread.sleep(delay);/* w w w . ja v a 2 s . com*/ deliveryChannel.basicPublish(deliveryExchangeName, order.getCustomerName(), MessageProperties.PERSISTENT_TEXT_PLAIN, order.getID().getBytes()); orders.setState(order, Order.EOrderState.DELIVERED); }
From source file:wiki.messaging.Receive.java
License:Open Source License
private static void saveResult(Channel results) throws IOException { if (jobs < maxJobs) { return;/* w w w. ja v a 2 s . c om*/ } try { Future<Result> result = threadPool.take(); byte[] message = encodeResult(result.get()).getBytes(); results.basicPublish("", RESULT_QUEUE_NAME, MessageProperties.PERSISTENT_TEXT_PLAIN, message); System.out.println(" [x] Sent '" + new String(message) + "'"); // result.get().save(results); jobs--; } catch (ExecutionException | InterruptedException e) { e.printStackTrace(); System.exit(1); } }
From source file:wiki.messaging.Treeceive.java
License:Open Source License
private static void saveResults(Channel resultChannel) throws IOException { if (jobs < maxJobs) { return;//from w ww . j av a 2 s . c o m } try { Future<ArrayList<Result>> results = threadPool.take(); ArrayList<Result> resultList = results.get(); for (Result r : resultList) { byte[] message = encodeResult(r).getBytes(); resultChannel.basicPublish("", RESULT_QUEUE_NAME, MessageProperties.PERSISTENT_TEXT_PLAIN, message); System.out.println(" [x] Sent '" + new String(message) + "'"); } jobs--; } catch (ExecutionException | InterruptedException e) { e.printStackTrace(); System.exit(1); } }
From source file:workqueue.NewTask.java
public static void main(String[] argv) throws Exception { ConnectionFactory factory = new ConnectionFactory(); factory.setHost("datdb.cphbusiness.dk"); Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); channel.queueDeclare(TASK_QUEUE_NAME, true, false, false, null); String message = getMessage(argv); channel.basicPublish("", TASK_QUEUE_NAME, MessageProperties.PERSISTENT_TEXT_PLAIN, message.getBytes("UTF-8")); System.out.println(" [x] Sent '" + message + "'"); channel.close();//from ww w.j a v a 2s .c om connection.close(); }