Package org.codehaus.stomp

Examples of org.codehaus.stomp.ProtocolException


        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/");
        }
    }
View Full Code Here


            String text;
            try {
                text = new String(command.getContent(), "UTF-8");
            }
            catch (Throwable e) {
                throw new ProtocolException("Text could not bet set: " + e, false, e);
            }
            msg = session.createTextMessage(text);
        }
        copyStandardHeadersFromFrameToMessage(command, msg);
        return msg;
View Full Code Here

TOP

Related Classes of org.codehaus.stomp.ProtocolException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.