use of com.swiftmq.jms.TopicImpl in project swiftmq-ce by iitsoftware.
the class TopicBroker method putMessage.
public void putMessage(Object transactionId, MessageImpl msg) throws QueueException {
lockAndWaitAsyncFinished();
try {
if (subscriptions.size() == 0)
return;
TopicTransaction transaction = (TopicTransaction) transactionId;
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$topicmanager", tracePrefix + "putMessage, transaction=" + transaction + ", message=" + msg);
// set dest queue for routing
if (msg.getDestQueue() == null) {
String s = getQueueName();
msg.setDestQueue(s.substring(0, s.indexOf('@')));
}
String topicName = null;
// local msgs haven't set a source router
boolean publishedLocal = msg.getSourceRouter() == null;
try {
TopicImpl topic = (TopicImpl) msg.getJMSDestination();
topicName = topic.getTopicName();
} catch (Exception ignored) {
}
String[] tokenizedPubTopic = topicName.indexOf(TopicManagerImpl.TOPIC_DELIMITER_CHAR) == -1 ? rootTokenized : ctx.topicManager.tokenizeTopicName(topicName);
List matchedNodes = null;
if (ctx.topicManager.isDirectSubscriberSelection())
matchedNodes = getMatchedNodes(tokenizedPubTopic);
else
matchedNodes = getMatchedNodes(getMatchedTopics(tokenizedPubTopic));
if (matchedNodes != null) {
for (int i = 0; i < matchedNodes.size(); i++) {
PredicateNode node = (PredicateNode) matchedNodes.get(i);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$topicmanager", tracePrefix + "putMessage, node: " + node + " does match");
publishToNode(transaction, msg, node, publishedLocal);
}
}
} finally {
lock.unlock();
}
}
Aggregations