use of com.rabbitmq.jms.parse.sql.SqlParser in project rabbitmq-jms-client by rabbitmq.
the class RMQSession method bindSelectorQueue.
private void bindSelectorQueue(RMQDestination dest, String jmsSelector, String queueName, String selectionExchange) throws InvalidSelectorException, IOException {
SqlCompiler compiler = new SqlCompiler(new SqlEvaluator(new SqlParser(new SqlTokenStream(jmsSelector)), JMS_TYPE_IDENTS));
if (compiler.compileOk()) {
Map<String, Object> args = new HashMap<String, Object>(5);
args.put(RJMS_COMPILED_SELECTOR_ARG, (Object) compiler.compile());
args.put(RJMS_VERSION_ARG, (Object) RJMS_CLIENT_VERSION);
// bind the queue to the topic selector exchange with the jmsSelector expression as argument
this.channel.queueBind(queueName, selectionExchange, dest.getAmqpRoutingKey(), args);
} else {
throw new RMQJMSSelectorException(String.format("Selector expression failure: \"%s\".", jmsSelector));
}
}
Aggregations