<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,14 +3,14 @@
 &lt;!--
 Copyright Notice
 ================
-&#169; Copyright JPMorgan Chase Bank &amp; Co., Cisco Systems, Inc., Envoy Technologies Inc.,
-iMatix Corporation, IONA&#65533; Technologies, Red Hat, Inc.,
+&#194;&#169; Copyright JPMorgan Chase Bank &amp; Co., Cisco Systems, Inc., Envoy Technologies Inc.,
+iMatix Corporation, IONA&#239;&#191;&#189; Technologies, Red Hat, Inc.,
 TWIST Process Innovations, and 29West Inc. 2006. All rights reserved.
 
 License
 =======
 JPMorgan Chase Bank &amp; Co., Cisco Systems, Inc., Envoy Technologies Inc., iMatix 
-Corporation, IONA&#65533; Technologies, Red Hat, Inc., TWIST Process Innovations, and 
+Corporation, IONA&#239;&#191;&#189; Technologies, Red Hat, Inc., TWIST Process Innovations, and 
 29West Inc. (collectively, the &quot;Authors&quot;) each hereby grants to you a worldwide,
 perpetual, royalty-free, nontransferable, nonexclusive license to
 (i) copy, display, and implement the Advanced Messaging Queue Protocol
@@ -1213,6 +1213,7 @@ localised reply text
                         / C:BIND     S:BIND-OK
                         / C:PURGE    S:PURGE-OK
                         / C:DELETE   S:DELETE-OK
+						/ C:UNBIND   S:UNBIND-OK
 &lt;/doc&gt;
     &lt;chassis name=&quot;server&quot; implement=&quot;MUST&quot;/&gt;
     &lt;chassis name=&quot;client&quot; implement=&quot;MUST&quot;/&gt;
@@ -1588,7 +1589,52 @@ localised reply text
     &lt;/doc&gt;
       &lt;/field&gt;
     &lt;/method&gt;
-    &lt;!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --&gt;
+
+	&lt;!-- UNBIND - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --&gt;
+
+	&lt;method name=&quot;unbind&quot; synchronous=&quot;1&quot; index=&quot;50&quot;&gt;
+		Unbind
+		&lt;doc&gt;
+		  This methods unbinds a queue
+		&lt;/doc&gt;
+		&lt;chassis name=&quot;server&quot; implement=&quot;MUST&quot;/&gt;
+		&lt;response name=&quot;unbind-ok&quot;/&gt;
+		&lt;field name=&quot;ticket&quot; domain=&quot;access ticket&quot;&gt;
+			&lt;doc&gt;The access ticket must be for the access realm that holds the
+		    queue.&lt;/doc&gt;
+		&lt;/field&gt;
+		&lt;field name=&quot;queue&quot; domain=&quot;queue name&quot;&gt;
+		  &lt;doc&gt;
+		    queue name
+		  &lt;/doc&gt;
+		&lt;/field&gt;
+		&lt;field name=&quot;exchange&quot; domain=&quot;exchange name&quot;&gt;
+		  &lt;doc&gt;
+		    exchange name
+		  &lt;/doc&gt;
+		&lt;/field&gt;
+		&lt;field name=&quot;routingkey&quot; type=&quot;shortstr&quot;&gt;
+		  &lt;doc&gt;
+		    routing key
+		  &lt;/doc&gt;
+		&lt;/field&gt;
+		&lt;field name=&quot;arguments&quot; type=&quot;table&quot;&gt;
+		  &lt;doc&gt;
+		    additional arguments
+		  &lt;/doc&gt;
+		&lt;/field&gt;
+	&lt;/method&gt;
+
+	&lt;method name=&quot;unbind-ok&quot; synchronous=&quot;1&quot; index=&quot;51&quot;&gt;
+		Unbind-ok
+		&lt;doc&gt;
+		  Confirms a queue unbind
+		&lt;/doc&gt;
+		&lt;chassis name=&quot;client&quot; implement=&quot;MUST&quot;/&gt;
+	&lt;/method&gt;
+
+    &lt;!-- UNBIND - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --&gt;
+
     &lt;method name=&quot;delete&quot; synchronous=&quot;1&quot; index=&quot;40&quot;&gt;
   delete a queue
   &lt;doc&gt;
@@ -2425,4 +2471,4 @@ confirm a successful rollback
       &lt;chassis name=&quot;client&quot; implement=&quot;MUST&quot;/&gt;
     &lt;/method&gt;
   &lt;/class&gt;
-&lt;/amqp&gt;
+&lt;/amqp&gt;
\ No newline at end of file</diff>
      <filename>codegen/specs/amqp0-8.xml</filename>
    </modified>
    <modified>
      <diff>@@ -17,7 +17,7 @@
  **/
 package org.amqp.patterns.impl
 {
-    import com.ericfeminella.utils.HashMap;
+    import de.polygonal.ds.HashMap;
 
     import flash.events.EventDispatcher;
     import flash.utils.ByteArray;
@@ -30,6 +30,7 @@ package org.amqp.patterns.impl
     import org.amqp.methods.basic.Consume;
     import org.amqp.methods.basic.Deliver;
     import org.amqp.methods.queue.Declare;
+    import org.amqp.methods.queue.Unbind;
     import org.amqp.patterns.CorrelatedMessageEvent;
     import org.amqp.patterns.Dispatcher;
     import org.amqp.patterns.SubscribeClient;
@@ -54,7 +55,7 @@ package org.amqp.patterns.impl
                 return;
             }
 
-            topics.insert(key, {callback:callback, consumerTag:null});
+            topics.insert(key, {callback:callback});
 
             if (replyQueue != null) {
                 dispatch(key, null);
@@ -64,20 +65,24 @@ package org.amqp.patterns.impl
         }
 
         public function unsubscribe(key:String):void {
-            var cancel:Cancel = new Cancel();
-            var topic:* = topics.getValue(key);
-            sessionHandler.unregister(topic.consumerTag);
+            var unbind:Unbind = new Unbind();
+            var topic:* = topics.find(key);
+            unbind.exchange = exchange;
+            unbind.queue = replyQueue;
+            unbind.routingkey = key;
+
+            sessionHandler.rpc(new Command(unbind), onUnbindOk);
+
+            dispatcher.removeEventListener(key, topic.callback);
             topics.remove(key);
         }
 
         public function dispatch(o:*, callback:Function):void {
-            var consume:Consume = new Consume();
-            consume.queue = replyQueue;
-            consume.noack = true;
-            consume.consumertag = replyQueue + &quot;:&quot; + o;
-            sessionHandler.register(consume, this);
-
             bindQueue(exchange, replyQueue, o);
+
+            var topic:* = topics.find(o);
+            topics.insert(o, topic);
+            dispatcher.addEventListener(o, topic.callback);
         }
 
         override protected function onChannelOpenOk(event:ProtocolEvent):void {
@@ -91,32 +96,30 @@ package org.amqp.patterns.impl
             var queue:Declare = new Declare();
             queue.queue = q;
             queue.autodelete = true;
-            sessionHandler.dispatch(new Command(queue));
+            sessionHandler.rpc(new Command(queue), onQueueDeclareOk);
         }
 
         override protected function onQueueDeclareOk(event:ProtocolEvent):void {
             replyQueue = getReplyQueue(event);
+
+            var consume:Consume = new Consume();
+            consume.queue = replyQueue;
+            consume.noack = true;
+            consume.consumertag = replyQueue;
+            sessionHandler.register(consume, this);
+
             sendBuffer.drain();
         }
 
-        public function onConsumeOk(tag:String):void {
-          var key:String = tag.split(&quot;:&quot;)[1];
-          var topic:* = topics.getValue(key);
+        public function onConsumeOk(tag:String):void {}
 
-          topic.consumerTag = tag;
-          topics.put(key, topic);
+        public function onCancelOk(tag:String):void {}
 
-          dispatcher.addEventListener(key, topic.callback);
-        }
-
-        public function onCancelOk(tag:String):void {
-            //trace(&quot;cancelled&quot;);
-        }
+        public function onUnbindOk(event:ProtocolEvent):void {}
 
         public function onDeliver(method:Deliver,
                                   properties:BasicProperties,
                                   body:ByteArray):void {
-
             trace(&quot;onDeliver&quot;);
             var result:* = serializer.deserialize(body);
 </diff>
      <filename>src/org/amqp/patterns/impl/SubscribeClientImpl.as</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>16c39a270e2cae46427a01db6c7040cbb3876015</id>
    </parent>
  </parents>
  <author>
    <name>Peter Kieltyka</name>
    <email>peter.kieltyka@nulayer.com</email>
  </author>
  <url>http://github.com/0x6e6562/as3-amqp/commit/718487dc9fabd00263f33ee1af753f3096859f92</url>
  <id>718487dc9fabd00263f33ee1af753f3096859f92</id>
  <committed-date>2008-10-06T10:17:46-07:00</committed-date>
  <authored-date>2008-10-06T10:17:46-07:00</authored-date>
  <message>Extended amqp0-8 spec to include Unbind/Unbind-Ok methods, as well as modified SubscribeClientImpl to unsubscribe by calling the Unbind command</message>
  <tree>18d1e154319fde57d86b219d7672595f2eba8fd7</tree>
  <committer>
    <name>Peter Kieltyka</name>
    <email>peter.kieltyka@nulayer.com</email>
  </committer>
</commit>
