public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages,
boolean noLocal) throws JMSException {
checkClosedOrFailed();
ensureConnectionInfoSent();
SessionId sessionId = new SessionId(info.getConnectionId(), -1);
ConsumerInfo info = new ConsumerInfo(new ConsumerId(sessionId, consumerIdGenerator.getNextSequenceId()));
info.setDestination(ActiveMQMessageTransformation.transformDestination(topic));
info.setSubscriptionName(subscriptionName);
info.setSelector(messageSelector);
info.setPrefetchSize(maxMessages);
info.setDispatchAsync(dispatchAsync);
// Allows the options on the destination to configure the consumerInfo
if (info.getDestination().getOptions() != null) {
Map<String, String> options = new HashMap<String, String>(info.getDestination().getOptions());
IntrospectionSupport.setProperties(this.info, options, "consumer.");
}
return new ActiveMQConnectionConsumer(this, sessionPool, info);
}