我们现在正在使用Java + ActiveMQ,并考虑迁移到C#+ RabbitMQ。
我现在正在学习RabbitMQ,并且找到了一个示例https://www.rabbitmq.com/tutorials/tutorial-six-dotnet.html,但我不明白如何在RabbitMQ中制作XPATH选择器。
现在,我们将Java代码与类似以下代码的ActiveMQ选择器(https://activemq.apache.org/selectors.html)一起使用:
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:55901");
// Create a Connection
Connection connection = connectionFactory.createConnection();
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination destination = session.createQueue("TEST.QUEUE");
MessageProducer producer = session.createProducer(destination);
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
Message message = session.createTextMessage("<?xml version='1.0' encoding='UTF-8'?><notification>this is a test</notification>");
producer.send(message);
MessageConsumer consumer = session.createConsumer(destination, "XPATH '/notification'");
Message message2 = consumer.receive(10000);
System.out.println("Received message: " + message2);
producer.close();
session.close();
connection.close();
consumer.close();
如何通过XPATH在C#RabbitMQ使用者选择器中创建逻辑,与上面的代码相同?