Commits

Jean-François Roche committed 11490f5

do not set backend if it is None - also mark adapted message with interface defined in consumer

Comments (0)

Files changed (4)

     instance01
     instance02
     omelette
+    scripts
     test
     coverage-test
     coverage-report
 [rabbitmq]
 # required erlang-dev erlang-base erlang-ssl erlang-os-mon erlang-mnesia
 recipe = rod.recipe.rabbitmq
-url = http://www.rabbitmq.com/releases/rabbitmq-server/v1.6.0/rabbitmq-server-1.6.0.tar.gz
+url = http://www.rabbitmq.com/releases/rabbitmq-server/v1.7.2/rabbitmq-server-1.7.2.tar.gz
 erlang-path = /usr/bin
 
 [test]
     Plone
     ${buildout:eggs}
 zope-conf-additional =
-    %import affinitic.zamqp
-    <amqp-consumer-server>
-      amqpconnection test
-      user admin
-      password admin
-      host localhost
-    </amqp-consumer-server>
-    #<amqp-consumer-server>
-    #  amqpconnection barfoo
-    #  user admin
-    #  password admin
-    #  host localhost
-    #</amqp-consumer-server>
-
-    #<product-config affinitic.zamqp>
-    #  autostart *@RootTaskService
-      #@blue
-    #</product-config>
 
 [instance02]
 recipe = ${instance01:recipe}
 zope-conf-additional = ${instance01:zope-conf-additional}
 zeo-client-cache-size = ${instance01:zeo-client-cache-size}
 zope-conf-additional =
-    %import affinitic.zamqp
-    <amqp-consumer-server>
-      amqpconnection test
-      user admin
-      password admin
-      host localhost
-    </amqp-consumer-server>
 
 [docs]
 recipe = z3c.recipe.sphinxdoc
 scripts = coverage
 arguments = ('coverage', 'coverage/report')
 
+[scripts]
+recipe = zc.recipe.egg:scripts
+eggs = affinitic.zamqp [zope212]
+
 [command]
 recipe = collective.recipe.cmd
 on_install = true

src/affinitic/zamqp/configure.zcml

 <configure xmlns="http://namespaces.zope.org/zope"
            xmlns:grok="http://namespaces.zope.org/grok"
+           xmlns:zcml="http://namespaces.zope.org/zcml"
            i18n_domain="zamqp">
 
     <include package="z3c.autoinclude" file="meta.zcml" />
     <includeDependencies package="." />
 
+    <configure zcml:condition="installed affinitic.zamqp">
+      <include package="five.dbevent" />
+    </configure>
+
     <subscriber
         for="zope.app.appsetup.interfaces.IDatabaseOpenedWithRootEvent"
         handler=".service.bootStrapSubscriber"/>

src/affinitic/zamqp/consumer.py

     def __init__(self, connection=None, queue=None, exchange=None,
             routing_key=None, **kwargs):
         self._connection = connection
-        self.backend = kwargs.get("backend", None)
+        backend = kwargs.get("backend", None)
+        if backend is not None:
+            self.backend = backend
         self.queue = queue or self.queue
         self.queue = queue or self.queue
         self.exchange = exchange or self.exchange
     def receive(self, message_data, message):
         message = self._markMessage(message)
         message = self._adaptMessage(message)
+        message = self._markMessage(message)
         if not self.callbacks:
             raise NotImplementedError("No consumer callbacks registered")
         for callback in self.callbacks:

src/affinitic/zamqp/consumerset.py

     def receive(self, message_data, message):
         message = self._markMessage(message)
         message = self._adaptMessage(message)
+        message = self._markMessage(message)
         if not self.callbacks:
             raise NotImplementedError("No consumer callbacks registered")
         for callback in self.callbacks: