Skip to content

Commit

Permalink
Renamed 'demo' connection to 'superuser' connection to say that it's …
Browse files Browse the repository at this point in the history
…consumed as admin. Defined 'anonymous' connection to be consumed as anonymous.
  • Loading branch information
datakurre committed Aug 27, 2012
1 parent e6b37b4 commit c3af2d0
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 17 deletions.
35 changes: 29 additions & 6 deletions buildout.cfg
Expand Up @@ -36,19 +36,28 @@ zope-conf-additional =
%import sauna.reload
%import collective.zamqp
<amqp-broker-connection>
connection_id demo
connection_id superuser
# hostname localhost
# virtual_host /
# username guest
# password guest
heartbeat 120
keepalive 30
</amqp-broker-connection>
<amqp-broker-connection>
connection_id anonymous
heartbeat 120
keepalive 30
</amqp-broker-connection>
<amqp-consuming-server>
connection_id demo
connection_id superuser
site_id Plone
user_id admin
</amqp-consuming-server>
<amqp-consuming-server>
connection_id anonymous
site_id Plone
</amqp-consuming-server>
zserver-threads = 4
# that's much more threads than necessary, but that way you'll see
# that collectice.zamqp manages with simultaneous threads
Expand All @@ -59,36 +68,50 @@ zope-conf-additional =
%import sauna.reload
%import collective.zamqp
<amqp-broker-connection>
connection_id demo
connection_id superuser
# hostname localhost
# virtual_host /
# username guest
# password guest
heartbeat 240
keepalive 60
</amqp-broker-connection>
<amqp-broker-connection>
connection_id anonymous
heartbeat 240
keepalive 60
</amqp-broker-connection>
zserver-threads = 4

[zamqp-consumer]
zope-conf-additional =
%import sauna.reload
%import collective.zamqp
<amqp-broker-connection>
connection_id demo
connection_id superuser
# hostname localhost
# virtual_host /
# username guest
# password guest
heartbeat 120
keepalive 30
</amqp-broker-connection>
<amqp-broker-connection>
connection_id anonymous
heartbeat 120
keepalive 30
</amqp-broker-connection>
<amqp-consuming-server>
connection_id demo
connection_id superuser
site_id Plone
user_id admin
</amqp-consuming-server>
<amqp-consuming-server>
connection_id anonymous
site_id Plone
</amqp-consuming-server>
zserver-threads = 1
# in production, use zserver-threads = 1
# in production, it's recommended to use zserver-threads = 1

[ports]
zeoserver = 8800
Expand Down
4 changes: 2 additions & 2 deletions src/collective/zamqpdemo/autopublish.py
Expand Up @@ -36,7 +36,7 @@ class AutoPublishProducer(Producer):
"""Produces auto-publishing requests"""
grok.name("amqpdemo.autopublish")

connection_id = "demo"
connection_id = "superuser"
serializer = "plain"

queue = "amqpdemo.autopublish.wait"
Expand All @@ -54,7 +54,7 @@ class AutoPublishConsumer(Consumer):
"""Consumes auto-publishing requests"""
grok.name("amqpdemo.autopublish") # is also the queue name

connection_id = "demo"
connection_id = "superuser"
marker = IAutoPublishMessage

durable = False
Expand Down
8 changes: 4 additions & 4 deletions src/collective/zamqpdemo/content.py
Expand Up @@ -48,7 +48,7 @@ class CreateItemProducer(Producer):
"""Produces item creation requests"""
grok.name("amqpdemo.create") # is also the routing key

connection_id = "demo"
connection_id = "superuser"
serializer = "msgpack"
queue = "amqpdemo.create"

Expand All @@ -59,7 +59,7 @@ class DeleteItemProducer(Producer):
"""Produces item deletion requests"""
grok.name("amqpdemo.delete") # is also the routing key

connection_id = "demo"
connection_id = "superuser"
serializer = "msgpack"
queue = "amqpdemo.delete"

Expand All @@ -70,7 +70,7 @@ class CreateItemConsumer(Consumer):
"""Consumes item creation messages"""
grok.name("amqpdemo.create") # is also the queue name

connection_id = "demo"
connection_id = "superuser"
marker = ICreateItemMessage

durable = False
Expand All @@ -80,7 +80,7 @@ class DeleteItemConsumer(Consumer):
"""Consumes item deletion messages"""
grok.name("amqpdemo.delete") # is also the queue name

connection_id = "demo"
connection_id = "superuser"
marker = IDeleteItemMessage

durable = False
Expand Down
8 changes: 5 additions & 3 deletions src/collective/zamqpdemo/message.py
Expand Up @@ -34,10 +34,11 @@ class QueueMessageProducer(Producer):
"""Produces queue message command"""
grok.name("amqpdemo.messages")

connection_id = "demo"
connection_id = "superuser"
exchange = "awaiting"
serializer = "plain"

auto_delete = False
durable = False

@property
Expand All @@ -53,14 +54,15 @@ class AwaitingMessages(Consumer):
"""Consumes purge-requests"""
grok.name("amqpdemo.${site_id}.awaiting") # is also the queue name

connection_id = "demo"
connection_id = "superuser"
exchange = "awaiting"
queue_arguments = {
"x-dead-letter-exchange": "messages", # redirect messages with reject
}
routing_key = "amqpdemo.${site_id}.messages"
marker = IMessage

auto_delete = False
durable = False

def on_ready_to_consume(self):
Expand All @@ -72,7 +74,7 @@ class MessageConsumer(Consumer):
"""Consumes purge-requests"""
grok.name("amqpdemo.${site_id}.messages") # is also the queue name

connection_id = "demo"
connection_id = "superuser"
exchange = "messages"
queue = "" # use generated queue name
routing_key = "amqpdemo.${site_id}.messages"
Expand Down
4 changes: 2 additions & 2 deletions src/collective/zamqpdemo/minutes.py
Expand Up @@ -78,7 +78,7 @@ class MinutesProducer(Producer):
"""Produces requests for PDF"""
grok.name("amqpdemo.minutes") # is also the routing key

connection_id = "demo"
connection_id = "superuser"
queue = "amqpdemo.minutes"
serializer = "plain"

Expand All @@ -89,7 +89,7 @@ class MinutesConsumer(Consumer):
"""Consumes requests for PDF"""
grok.name("amqpdemo.minutes") # is also the queue name

connection_id = "demo"
connection_id = "superuser"
marker = IMinutesMessage

durable = False
Expand Down

0 comments on commit c3af2d0

Please sign in to comment.