@Override
public Response request(Object content, Codec codec,
Codecs codecs,
Map<MessageOpOption, Object> options) throws Exception {
final Options<MessageOpOption> opts = new Options<>(options);
final String id = UUID.randomUUID().toString();
final JMSSpecificContext context = (JMSSpecificContext)opts.get(MessageOpOption.CONTEXT);
final String nodeId = context != null ? context.id() : JMSMessagingSkeleton.BROKER_ID;
final ConcreteResponse response = new ConcreteResponse();
Options<ListenOption> routerOpts = new Options<>();
routerOpts.put(ListenOption.CONCURRENCY, 1);
routerOpts.put(ListenOption.SELECTOR,
JMSMessage.REQUEST_NODE_ID_PROPERTY + " = '" + nodeId + "' AND " +
JMSMessage.SYNC_RESPONSE_PROPERTY + " = TRUE");
if (context != null &&
context.isRemote()) {
routerOpts.put(ListenOption.CONTEXT, context);
}
ResponseRouter.routerFor(this, codecs, routerOpts).registerResponse(id, response);
publish(content, codec, options,
new HashMap<String, Object>() {{
put(JMSMessage.REQUEST_NODE_ID_PROPERTY, nodeId);
put(JMSMessage.SYNC_PROPERTY, true);
put(JMSMessage.REQUEST_ID_PROPERTY, id);
}});
return response;
}