protocolConverter.sendToStomp(frame);
}
public Destination convertDestination(String name, boolean forceNew) throws ProtocolException, JMSException {
if (name == null) {
throw new ProtocolException("No destination is specified!");
}
else if (name.startsWith("/queue/")) {
String queueName = name.substring("/queue/".length(), name.length());
return session.createQueue(queueName);
}
else if (name.startsWith("/topic/")) {
String topicName = name.substring("/topic/".length(), name.length());
return session.createTopic(topicName);
}
else if (name.startsWith("/temp-queue/")) {
String tempName = name.substring("/temp-queue/".length(), name.length());
Destination answer = temporaryDestinations.get(tempName);
if (forceNew || answer == null) {
return temporaryDestination(tempName, session.createTemporaryQueue());
} else {
return answer;
}
}
else if (name.startsWith("/temp-topic/")) {
String tempName = name.substring("/temp-topic/".length(), name.length());
Destination answer = temporaryDestinations.get(tempName);
if (forceNew || answer == null) {
return temporaryDestination(tempName, session.createTemporaryTopic());
} else {
return answer;
}
}
else {
throw new ProtocolException("Illegal destination name: [" + name + "] -- StompConnect destinations " +
"must begine with one of: /queue/ /topic/ /temp-queue/ /temp-topic/");
}
}