activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r741109 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp: ProtocolConverter.java StompConnection.java StompTransportFilter.java
Date Thu, 05 Feb 2009 14:34:00 GMT
Author: dejanb
Date: Thu Feb  5 14:33:59 2009
New Revision: 741109

URL: http://svn.apache.org/viewvc?rev=741109&view=rev
Log:
a couple of Stomp improvements

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompConnection.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java?rev=741109&r1=741108&r2=741109&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java
Thu Feb  5 14:33:59 2009
@@ -161,7 +161,7 @@
 	 * 
 	 * @param command
 	 */
-    public void onStompCommad(StompFrame command) throws IOException, JMSException {
+    public void onStompCommand(StompFrame command) throws IOException, JMSException {
         try {
 
             if (command.getClass() == StompFrameError.class) {
@@ -459,6 +459,8 @@
         throw new ProtocolException("No subscription matched.");
     }
 
+    ConnectionInfo connectionInfo = new ConnectionInfo();
+    
     protected void onStompConnect(final StompFrame command) throws ProtocolException {
 
         if (connected.get()) {
@@ -472,7 +474,6 @@
         String passcode = headers.get(Stomp.Headers.Connect.PASSCODE);
         String clientId = headers.get(Stomp.Headers.Connect.CLIENT_ID);
 
-        final ConnectionInfo connectionInfo = new ConnectionInfo();
 
         IntrospectionSupport.setProperties(connectionInfo, headers, "activemq.");
 
@@ -540,6 +541,7 @@
 
     protected void onStompDisconnect(StompFrame command) throws ProtocolException {
         checkConnected();
+        sendToActiveMQ(connectionInfo.createRemoveCommand(), createResponseHandler(command));
         sendToActiveMQ(new ShutdownInfo(), createResponseHandler(command));
         connected.set(false);
     }
@@ -556,7 +558,7 @@
      * @param command
      * @throws IOException
      */
-    public void onActiveMQCommad(Command command) throws IOException, JMSException {
+    public void onActiveMQCommand(Command command) throws IOException, JMSException {
         if (command.isResponse()) {
 
             Response response = (Response)command;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompConnection.java?rev=741109&r1=741108&r2=741109&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompConnection.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompConnection.java
Thu Feb  5 14:33:59 2009
@@ -107,9 +107,16 @@
 	}
 	
     public void connect(String username, String password) throws Exception {
+        connect(username, password, null);
+    }
+	
+    public void connect(String username, String password, String client) throws Exception
{
     	HashMap<String, String> headers = new HashMap();
     	headers.put("login", username);
     	headers.put("passcode", password);
+    	if (client != null) {
+    		headers.put("client-id", client);
+    	}
     	StompFrame frame = new StompFrame("CONNECT", headers);
         sendFrame(frame.toString());
         

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java?rev=741109&r1=741108&r2=741109&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java
Thu Feb  5 14:33:59 2009
@@ -53,7 +53,7 @@
     public void oneway(Object o) throws IOException {
         try {
             final Command command = (Command)o;
-            protocolConverter.onActiveMQCommad(command);
+            protocolConverter.onActiveMQCommand(command);
         } catch (JMSException e) {
             throw IOExceptionSupport.create(e);
         }
@@ -64,7 +64,7 @@
             if (trace) {
                 LOG.trace("Received: \n" + command);
             }
-            protocolConverter.onStompCommad((StompFrame)command);
+            protocolConverter.onStompCommand((StompFrame)command);
         } catch (IOException e) {
             onException(e);
         } catch (JMSException e) {



Mime
View raw message