mirror of
https://git.kotyczka.ch/developers/django.git
synced 2025-04-07 00:03:32 +02:00
queue folder
This commit is contained in:
parent
c0e0f72a53
commit
a1854a726a
BIN
app/queue/__pycache__/config.cpython-311.pyc
Normal file
BIN
app/queue/__pycache__/config.cpython-311.pyc
Normal file
Binary file not shown.
45
app/queue/ampq_client.py
Normal file
45
app/queue/ampq_client.py
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import optparse
|
||||||
|
from proton import Message
|
||||||
|
from proton.handlers import MessagingHandler
|
||||||
|
from proton.reactor import Container
|
||||||
|
|
||||||
|
|
||||||
|
class Client(MessagingHandler):
|
||||||
|
def __init__(self, url, requests):
|
||||||
|
super(Client, self).__init__()
|
||||||
|
self.url = url
|
||||||
|
self.requests = requests
|
||||||
|
|
||||||
|
def on_start(self, event):
|
||||||
|
self.sender = event.container.create_sender(self.url)
|
||||||
|
self.receiver = event.container.create_receiver(self.sender.connection, None, dynamic=True)
|
||||||
|
|
||||||
|
def next_request(self):
|
||||||
|
if self.receiver.remote_source.address:
|
||||||
|
req = Message(reply_to=self.receiver.remote_source.address, body=self.requests[0])
|
||||||
|
self.sender.send(req)
|
||||||
|
|
||||||
|
def on_link_opened(self, event):
|
||||||
|
if event.receiver == self.receiver:
|
||||||
|
self.next_request()
|
||||||
|
|
||||||
|
def on_message(self, event):
|
||||||
|
print("%s => %s" % (self.requests.pop(0), event.message.body))
|
||||||
|
if self.requests:
|
||||||
|
self.next_request()
|
||||||
|
else:
|
||||||
|
event.connection.close()
|
||||||
|
|
||||||
|
|
||||||
|
REQUESTS = ["Twas brillig, and the slithy toves",
|
||||||
|
"Did gire and gymble in the wabe.",
|
||||||
|
"All mimsy were the borogroves,",
|
||||||
|
"And the mome raths outgrabe."]
|
||||||
|
|
||||||
|
parser = optparse.OptionParser(usage="usage: %prog [options]",
|
||||||
|
description="Send requests to the supplied address and print responses.")
|
||||||
|
parser.add_option("-a", "--address", default="localhost:5672/examples",
|
||||||
|
help="address to which messages are sent (default %default)")
|
||||||
|
opts, args = parser.parse_args()
|
||||||
|
|
||||||
|
Container(Client(opts.address, args or REQUESTS)).run()
|
29
app/queue/ampq_receiver.py
Normal file
29
app/queue/ampq_receiver.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import optparse
|
||||||
|
import time
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from proton import Message
|
||||||
|
from proton.utils import BlockingConnection
|
||||||
|
from proton.handlers import IncomingMessageHandler
|
||||||
|
|
||||||
|
broker = '5672' ##os.getenv('AMQP_BROKER_HOST_PORT')
|
||||||
|
queue = 'proton' ##os.getenv('AMQP_ADDRESS')
|
||||||
|
user_arg = 'smx' ##os.getenv('AMQP_USER')
|
||||||
|
userpw_arg = 'smx' ##os.getenv('AMQP_USER_PASSWORD')
|
||||||
|
|
||||||
|
conn = BlockingConnection(broker, user=user_arg, password=userpw_arg)
|
||||||
|
receiver = conn.create_receiver(queue)
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
msg = receiver.receive(timeout=None)
|
||||||
|
count += 1
|
||||||
|
print("got message, processing for two seconds...")
|
||||||
|
sys.stdout.flush()
|
||||||
|
time.sleep(2)
|
||||||
|
receiver.accept()
|
||||||
|
finally:
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
print ("All done. Processed ", count, " messages.")
|
52
app/queue/ampq_sender.py
Normal file
52
app/queue/ampq_sender.py
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
from __future__ import print_function, unicode_literals
|
||||||
|
import optparse
|
||||||
|
from proton import Message
|
||||||
|
from proton.handlers import MessagingHandler
|
||||||
|
from proton.reactor import Container
|
||||||
|
from proton.utils import BlockingConnection
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
broker = '5672' ##os.getenv('AMQP_BROKER_HOST_PORT')
|
||||||
|
queue = 'proton' ##os.getenv('AMQP_ADDRESS')
|
||||||
|
user_arg = 'smx' ##os.getenv('AMQP_USER')
|
||||||
|
userpw_arg = 'smx' ##os.getenv('AMQP_USER_PASSWORD')
|
||||||
|
|
||||||
|
class Send(MessagingHandler):
|
||||||
|
def __init__(self, url, messages):
|
||||||
|
super(Send, self).__init__()
|
||||||
|
self.url = url
|
||||||
|
self.sent = 0
|
||||||
|
self.confirmed = 0
|
||||||
|
self.total = messages
|
||||||
|
|
||||||
|
def on_start(self, event):
|
||||||
|
event.container.create_sender(self.url)
|
||||||
|
|
||||||
|
def on_sendable(self, event):
|
||||||
|
while event.sender.credit and self.sent < self.total:
|
||||||
|
msg = Message(id=(self.sent+1), body={'sequence':(self.sent+1)})
|
||||||
|
event.sender.send(msg)
|
||||||
|
self.sent += 1
|
||||||
|
|
||||||
|
def on_accepted(self, event):
|
||||||
|
self.confirmed += 1
|
||||||
|
if self.confirmed == self.total:
|
||||||
|
print("all messages confirmed")
|
||||||
|
event.connection.close()
|
||||||
|
|
||||||
|
def on_disconnected(self, event):
|
||||||
|
self.sent = self.confirmed
|
||||||
|
|
||||||
|
conn = BlockingConnection(broker, user=user_arg, password=userpw_arg)
|
||||||
|
|
||||||
|
parser = optparse.OptionParser(usage="usage: %prog [options]",
|
||||||
|
description="Send messages to the supplied address.")
|
||||||
|
parser.add_option("-a", "--address", default="0.0.0.0:16161/examples",
|
||||||
|
help="address to which messages are sent (default %default)")
|
||||||
|
parser.add_option("-m", "--messages", type="int", default=100,
|
||||||
|
help="number of messages to send (default %default)")
|
||||||
|
opts, args = parser.parse_args()
|
||||||
|
|
||||||
|
try:
|
||||||
|
Container(Send(opts.address, opts.messages)).run()
|
||||||
|
except KeyboardInterrupt: pass
|
51
app/queue/ampq_server.py
Normal file
51
app/queue/ampq_server.py
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import optparse
|
||||||
|
import sys
|
||||||
|
from proton import Condition, Message, Url
|
||||||
|
from proton.handlers import MessagingHandler
|
||||||
|
from proton.reactor import Container
|
||||||
|
|
||||||
|
exit_status = 0
|
||||||
|
|
||||||
|
|
||||||
|
class Server(MessagingHandler):
|
||||||
|
def __init__(self, url, address):
|
||||||
|
super(Server, self).__init__()
|
||||||
|
self.url = url
|
||||||
|
self.address = address
|
||||||
|
|
||||||
|
def on_start(self, event):
|
||||||
|
print("Listening on", self.url)
|
||||||
|
self.container = event.container
|
||||||
|
self.conn = event.container.connect(self.url, desired_capabilities="ANONYMOUS-RELAY")
|
||||||
|
|
||||||
|
def on_connection_opened(self, event):
|
||||||
|
if event.connection.remote_offered_capabilities and 'ANONYMOUS-RELAY' in event.connection.remote_offered_capabilities:
|
||||||
|
self.receiver = event.container.create_receiver(self.conn, self.address)
|
||||||
|
self.server = self.container.create_sender(self.conn, None)
|
||||||
|
else:
|
||||||
|
global exit_status
|
||||||
|
print("Server needs a broker which supports ANONYMOUS-RELAY", file=sys.stderr)
|
||||||
|
exit_status = 1
|
||||||
|
c = event.connection
|
||||||
|
c.condition = Condition('amqp:not-implemented', description="ANONYMOUS-RELAY required")
|
||||||
|
c.close()
|
||||||
|
|
||||||
|
def on_message(self, event):
|
||||||
|
print("Received", event.message)
|
||||||
|
self.server.send(Message(address=event.message.reply_to, body=event.message.body.upper(),
|
||||||
|
correlation_id=event.message.correlation_id))
|
||||||
|
|
||||||
|
|
||||||
|
parser = optparse.OptionParser(usage="usage: %prog [options]")
|
||||||
|
parser.add_option("-a", "--address", default="localhost:5672/examples",
|
||||||
|
help="address from which messages are received (default %default)")
|
||||||
|
opts, args = parser.parse_args()
|
||||||
|
|
||||||
|
url = Url(opts.address)
|
||||||
|
|
||||||
|
try:
|
||||||
|
Container(Server(url, url.path)).run()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
|
|
||||||
|
sys.exit(exit_status)
|
96
app/queue/client_http.py
Normal file
96
app/queue/client_http.py
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
import tornado.ioloop
|
||||||
|
import tornado.web
|
||||||
|
from tornado.gen import coroutine
|
||||||
|
from tornado.concurrent import Future
|
||||||
|
from proton import Message
|
||||||
|
from proton.handlers import MessagingHandler
|
||||||
|
from proton_tornado import Container
|
||||||
|
|
||||||
|
|
||||||
|
class Client(MessagingHandler):
|
||||||
|
def __init__(self, host, address):
|
||||||
|
super(Client, self).__init__()
|
||||||
|
self.host = host
|
||||||
|
self.address = address
|
||||||
|
self.sent = []
|
||||||
|
self.pending = []
|
||||||
|
self.reply_address = None
|
||||||
|
self.sender = None
|
||||||
|
self.receiver = None
|
||||||
|
|
||||||
|
def on_start(self, event):
|
||||||
|
conn = event.container.connect(self.host)
|
||||||
|
self.sender = event.container.create_sender(conn, self.address)
|
||||||
|
self.receiver = event.container.create_receiver(conn, None, dynamic=True)
|
||||||
|
|
||||||
|
def on_link_opened(self, event):
|
||||||
|
if event.receiver == self.receiver:
|
||||||
|
self.reply_address = event.link.remote_source.address
|
||||||
|
self.do_request()
|
||||||
|
|
||||||
|
def on_sendable(self, event):
|
||||||
|
self.do_request()
|
||||||
|
|
||||||
|
def on_message(self, event):
|
||||||
|
if self.sent:
|
||||||
|
request, future = self.sent.pop(0)
|
||||||
|
print("%s => %s" % (request, event.message.body))
|
||||||
|
future.set_result(event.message.body)
|
||||||
|
self.do_request()
|
||||||
|
|
||||||
|
def do_request(self):
|
||||||
|
if self.pending and self.reply_address and self.sender.credit:
|
||||||
|
request, future = self.pending.pop(0)
|
||||||
|
self.sent.append((request, future))
|
||||||
|
req = Message(reply_to=self.reply_address, body=request)
|
||||||
|
self.sender.send(req)
|
||||||
|
|
||||||
|
def request(self, body):
|
||||||
|
future = Future()
|
||||||
|
self.pending.append((body, future))
|
||||||
|
self.do_request()
|
||||||
|
self.container.touch()
|
||||||
|
return future
|
||||||
|
|
||||||
|
|
||||||
|
class ExampleHandler(tornado.web.RequestHandler):
|
||||||
|
def initialize(self, client):
|
||||||
|
self.client = client
|
||||||
|
|
||||||
|
def get(self):
|
||||||
|
self._write_open()
|
||||||
|
self._write_form()
|
||||||
|
self._write_close()
|
||||||
|
|
||||||
|
@coroutine
|
||||||
|
def post(self):
|
||||||
|
response = yield self.client.request(self.get_body_argument("message"))
|
||||||
|
self.set_header("Content-Type", "text/html")
|
||||||
|
self._write_open()
|
||||||
|
self._write_form()
|
||||||
|
self.write("Response: " + response)
|
||||||
|
self._write_close()
|
||||||
|
|
||||||
|
def _write_open(self):
|
||||||
|
self.write('<html><body>')
|
||||||
|
|
||||||
|
def _write_close(self):
|
||||||
|
self.write('</body></html>')
|
||||||
|
|
||||||
|
def _write_form(self):
|
||||||
|
self.write('<form action="/client" method="POST">'
|
||||||
|
'Request: <input type="text" name="message">'
|
||||||
|
'<input type="submit" value="Submit">'
|
||||||
|
'</form>')
|
||||||
|
|
||||||
|
|
||||||
|
loop = tornado.ioloop.IOLoop.instance()
|
||||||
|
client = Client("localhost:5672", "examples")
|
||||||
|
client.container = Container(client, loop=loop)
|
||||||
|
client.container.initialise()
|
||||||
|
app = tornado.web.Application([tornado.web.url(r"/client", ExampleHandler, dict(client=client))])
|
||||||
|
app.listen(8888)
|
||||||
|
try:
|
||||||
|
loop.start()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
loop.stop()
|
5
app/queue/config.py
Normal file
5
app/queue/config.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
username = 'smx'
|
||||||
|
password = 'smx'
|
||||||
|
|
||||||
|
#username = 'mqadmin'
|
||||||
|
#password = '3Mnj29jKBsFybc'
|
0
app/queue/connect.json
Normal file
0
app/queue/connect.json
Normal file
79
app/queue/db_receive.py
Normal file
79
app/queue/db_receive.py
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
import optparse
|
||||||
|
from proton.handlers import MessagingHandler
|
||||||
|
from proton.reactor import ApplicationEvent, Container, EventInjector
|
||||||
|
from db_common import Db
|
||||||
|
|
||||||
|
|
||||||
|
class Recv(MessagingHandler):
|
||||||
|
def __init__(self, url, count):
|
||||||
|
super(Recv, self).__init__(auto_accept=False)
|
||||||
|
self.url = url
|
||||||
|
self.delay = 0
|
||||||
|
self.last_id = None
|
||||||
|
self.expected = count
|
||||||
|
self.received = 0
|
||||||
|
self.accepted = 0
|
||||||
|
self.db = Db("dst_db", EventInjector())
|
||||||
|
|
||||||
|
def on_start(self, event):
|
||||||
|
event.container.selectable(self.db.injector)
|
||||||
|
e = ApplicationEvent("id_loaded")
|
||||||
|
e.container = event.container
|
||||||
|
self.db.get_id(e)
|
||||||
|
|
||||||
|
def on_id_loaded(self, event):
|
||||||
|
self.last_id = event.id
|
||||||
|
event.container.create_receiver(self.url)
|
||||||
|
|
||||||
|
def on_record_inserted(self, event):
|
||||||
|
self.accept(event.delivery)
|
||||||
|
self.accepted += 1
|
||||||
|
if self.accepted == self.expected:
|
||||||
|
event.connection.close()
|
||||||
|
self.db.close()
|
||||||
|
|
||||||
|
def on_message(self, event):
|
||||||
|
id = int(event.message.id)
|
||||||
|
if (not self.last_id) or id > self.last_id:
|
||||||
|
if self.expected == 0 or self.received < self.expected:
|
||||||
|
self.received += 1
|
||||||
|
self.last_id = id
|
||||||
|
self.db.insert(id, event.message.body, ApplicationEvent("record_inserted", delivery=event.delivery))
|
||||||
|
print("inserted message %s" % id)
|
||||||
|
else:
|
||||||
|
self.release(event.delivery)
|
||||||
|
else:
|
||||||
|
self.accept(event.delivery)
|
||||||
|
|
||||||
|
|
||||||
|
parser = optparse.OptionParser(usage="usage: %prog [options]")
|
||||||
|
parser.add_option("-a", "--address", default="localhost:5672/examples",
|
||||||
|
help="address from which messages are received (default %default)")
|
||||||
|
parser.add_option("-m", "--messages", type="int", default=0,
|
||||||
|
help="number of messages to receive; 0 receives indefinitely (default %default)")
|
||||||
|
opts, args = parser.parse_args()
|
||||||
|
|
||||||
|
try:
|
||||||
|
Container(Recv(opts.address, opts.messages)).run()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
110
app/queue/db_send.py
Normal file
110
app/queue/db_send.py
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
import optparse
|
||||||
|
import queue
|
||||||
|
|
||||||
|
|
||||||
|
from proton import Message
|
||||||
|
from proton.handlers import MessagingHandler
|
||||||
|
from proton.reactor import ApplicationEvent, Container, EventInjector
|
||||||
|
from db_common import Db
|
||||||
|
|
||||||
|
|
||||||
|
class Send(MessagingHandler):
|
||||||
|
def __init__(self, url, count):
|
||||||
|
super(Send, self).__init__()
|
||||||
|
self.url = url
|
||||||
|
self.delay = 0
|
||||||
|
self.sent = 0
|
||||||
|
self.confirmed = 0
|
||||||
|
self.load_count = 0
|
||||||
|
self.records = queue.Queue(maxsize=50)
|
||||||
|
self.target = count
|
||||||
|
self.db = Db("src_db", EventInjector())
|
||||||
|
|
||||||
|
def keep_sending(self):
|
||||||
|
return self.target == 0 or self.sent < self.target
|
||||||
|
|
||||||
|
def on_start(self, event):
|
||||||
|
self.container = event.container
|
||||||
|
self.container.selectable(self.db.injector)
|
||||||
|
self.sender = self.container.create_sender(self.url)
|
||||||
|
|
||||||
|
def on_records_loaded(self, event):
|
||||||
|
if self.records.empty():
|
||||||
|
if event.subject == self.load_count:
|
||||||
|
print("Exhausted available data, waiting to recheck...")
|
||||||
|
# check for new data after 5 seconds
|
||||||
|
self.container.schedule(5, self)
|
||||||
|
else:
|
||||||
|
self.send()
|
||||||
|
|
||||||
|
def request_records(self):
|
||||||
|
if not self.records.full():
|
||||||
|
print("loading records...")
|
||||||
|
self.load_count += 1
|
||||||
|
self.db.load(self.records, event=ApplicationEvent(
|
||||||
|
"records_loaded", link=self.sender, subject=self.load_count))
|
||||||
|
|
||||||
|
def on_sendable(self, event):
|
||||||
|
self.send()
|
||||||
|
|
||||||
|
def send(self):
|
||||||
|
while self.sender.credit and not self.records.empty():
|
||||||
|
if not self.keep_sending():
|
||||||
|
return
|
||||||
|
record = self.records.get(False)
|
||||||
|
id = record['id']
|
||||||
|
self.sender.send(Message(id=id, durable=True, body=record['description']), tag=str(id))
|
||||||
|
self.sent += 1
|
||||||
|
print("sent message %s" % id)
|
||||||
|
self.request_records()
|
||||||
|
|
||||||
|
def on_settled(self, event):
|
||||||
|
id = int(event.delivery.tag)
|
||||||
|
self.db.delete(id)
|
||||||
|
print("settled message %s" % id)
|
||||||
|
self.confirmed += 1
|
||||||
|
if self.confirmed == self.target:
|
||||||
|
event.connection.close()
|
||||||
|
self.db.close()
|
||||||
|
|
||||||
|
def on_disconnected(self, event):
|
||||||
|
self.db.reset()
|
||||||
|
self.sent = self.confirmed
|
||||||
|
|
||||||
|
def on_timer_task(self, event):
|
||||||
|
print("Rechecking for data...")
|
||||||
|
self.request_records()
|
||||||
|
|
||||||
|
|
||||||
|
parser = optparse.OptionParser(usage="usage: %prog [options]",
|
||||||
|
description="Send messages to the supplied address.")
|
||||||
|
parser.add_option("-a", "--address", default="localhost:5672/examples",
|
||||||
|
help="address to which messages are sent (default %default)")
|
||||||
|
parser.add_option("-m", "--messages", type="int", default=0,
|
||||||
|
help="number of messages to send; 0 sends indefinitely (default %default)")
|
||||||
|
opts, args = parser.parse_args()
|
||||||
|
|
||||||
|
try:
|
||||||
|
Container(Send(opts.address, opts.messages)).run()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
6
app/queue/send.py
Normal file
6
app/queue/send.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import stomp
|
||||||
|
|
||||||
|
conn = stomp.Connection()
|
||||||
|
conn.connect('smx', 'smx', wait=True)
|
||||||
|
conn.send(content_type='application/raw',body=' Hello Stomp ', destination='/queue/test')
|
||||||
|
conn.disconnect()
|
39
app/queue/test.py
Normal file
39
app/queue/test.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import stomp
|
||||||
|
from stomp.listener import TestListener
|
||||||
|
import testutils
|
||||||
|
|
||||||
|
|
||||||
|
##@pytest.fixture()
|
||||||
|
def conn():
|
||||||
|
conn = stomp.Connection11(get_artemis_host())
|
||||||
|
conn.set_listener("testlistener", TestListener("123", print_to_log=True))
|
||||||
|
conn.connect(get_artemis_user(), get_artemis_password(), wait=True)
|
||||||
|
yield conn
|
||||||
|
conn.disconnect(receipt=None)
|
||||||
|
|
||||||
|
|
||||||
|
##@pytest.fixture()
|
||||||
|
def conn2():
|
||||||
|
conn2 = stomp.Connection11(get_artemis_host())
|
||||||
|
conn2.set_listener("testlistener", TestListener("456", print_to_log=True))
|
||||||
|
conn2.connect(get_artemis_user(), get_artemis_password(), wait=True, headers={'consumerWindowSize': 0})
|
||||||
|
yield conn2
|
||||||
|
conn2.disconnect(receipt=None)
|
||||||
|
|
||||||
|
|
||||||
|
class TestArtemis(object):
|
||||||
|
|
||||||
|
def test_send_to_artemis(self, conn):
|
||||||
|
conn.subscribe(destination="/queue/test", id=1, ack="auto")
|
||||||
|
|
||||||
|
conn.send(body="this is a test", destination="/queue/test", receipt="123")
|
||||||
|
|
||||||
|
validate_send(conn)
|
||||||
|
|
||||||
|
def test_prefetchsize(self, conn2):
|
||||||
|
conn2.subscribe(destination="/queue/test2", id=2, ack="auto", headers={'consumerWindowSize': 0})
|
||||||
|
|
||||||
|
conn2.send(body="testing sending a message after subscribing with prefetch",
|
||||||
|
destination="/queue/test2", receipt="456")
|
||||||
|
|
||||||
|
validate_send(conn2)
|
1
queue/data/.erlang.cookie
Normal file
1
queue/data/.erlang.cookie
Normal file
@ -0,0 +1 @@
|
|||||||
|
EASVPCBJZKYPFVDBKWIE
|
17
queue/data/mnesia/rabbit@5c60bc6971d3-feature_flags
Normal file
17
queue/data/mnesia/rabbit@5c60bc6971d3-feature_flags
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[classic_mirrored_queue_version,
|
||||||
|
classic_queue_type_delivery_support,
|
||||||
|
direct_exchange_routing_v2,
|
||||||
|
drop_unroutable_metric,
|
||||||
|
empty_basic_get_metric,
|
||||||
|
feature_flags_v2,
|
||||||
|
implicit_default_bindings,
|
||||||
|
listener_records_in_ets,
|
||||||
|
maintenance_mode_status,
|
||||||
|
quorum_queue,
|
||||||
|
restart_streams,
|
||||||
|
stream_queue,
|
||||||
|
stream_sac_coordinator_unblock_group,
|
||||||
|
stream_single_active_consumer,
|
||||||
|
tracking_records_in_ets,
|
||||||
|
user_limits,
|
||||||
|
virtual_host_metadata].
|
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/DECISION_TAB.LOG
Normal file
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/DECISION_TAB.LOG
Normal file
Binary file not shown.
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/LATEST.LOG
Normal file
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/LATEST.LOG
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
{[rabbit@5c60bc6971d3],[rabbit@5c60bc6971d3]}.
|
@ -0,0 +1 @@
|
|||||||
|
RAWA
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
%% This file is auto-generated! Edit at your own risk!
|
||||||
|
{segment_entry_count, 2048}.
|
@ -0,0 +1 @@
|
|||||||
|
/
|
@ -0,0 +1,2 @@
|
|||||||
|
{client_refs,[]}.
|
||||||
|
{index_module,rabbit_msg_store_ets_index}.
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
{client_refs,[]}.
|
||||||
|
{index_module,rabbit_msg_store_ets_index}.
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
VHOST: /
|
||||||
|
QUEUE: AllInfo
|
@ -0,0 +1,2 @@
|
|||||||
|
VHOST: /
|
||||||
|
QUEUE: PartInfo
|
Binary file not shown.
1
queue/data/mnesia/rabbit@5c60bc6971d3/node-type.txt
Normal file
1
queue/data/mnesia/rabbit@5c60bc6971d3/node-type.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
disc.
|
@ -0,0 +1 @@
|
|||||||
|
[rabbit@5c60bc6971d3].
|
@ -0,0 +1 @@
|
|||||||
|
RAWA
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
cXM
|
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_durable_queue.DCL
Normal file
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_durable_queue.DCL
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
cXM
|
Binary file not shown.
1
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_serial
Normal file
1
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_serial
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.
|
@ -0,0 +1 @@
|
|||||||
|
cXM
|
1
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_user.DCD
Normal file
1
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_user.DCD
Normal file
@ -0,0 +1 @@
|
|||||||
|
cXM
|
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_user.DCL
Normal file
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_user.DCL
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
cXM
|
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_user_permission.DCL
Normal file
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_user_permission.DCL
Normal file
Binary file not shown.
1
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_vhost.DCD
Normal file
1
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_vhost.DCD
Normal file
@ -0,0 +1 @@
|
|||||||
|
cXM
|
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_vhost.DCL
Normal file
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/rabbit_vhost.DCL
Normal file
Binary file not shown.
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/schema.DAT
Normal file
BIN
queue/data/mnesia/rabbit@5c60bc6971d3/schema.DAT
Normal file
Binary file not shown.
17
queue/data/mnesia/rabbit@deb2ec87ffa7-feature_flags
Normal file
17
queue/data/mnesia/rabbit@deb2ec87ffa7-feature_flags
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[classic_mirrored_queue_version,
|
||||||
|
classic_queue_type_delivery_support,
|
||||||
|
direct_exchange_routing_v2,
|
||||||
|
drop_unroutable_metric,
|
||||||
|
empty_basic_get_metric,
|
||||||
|
feature_flags_v2,
|
||||||
|
implicit_default_bindings,
|
||||||
|
listener_records_in_ets,
|
||||||
|
maintenance_mode_status,
|
||||||
|
quorum_queue,
|
||||||
|
restart_streams,
|
||||||
|
stream_queue,
|
||||||
|
stream_sac_coordinator_unblock_group,
|
||||||
|
stream_single_active_consumer,
|
||||||
|
tracking_records_in_ets,
|
||||||
|
user_limits,
|
||||||
|
virtual_host_metadata].
|
BIN
queue/data/mnesia/rabbit@deb2ec87ffa7/DECISION_TAB.LOG
Normal file
BIN
queue/data/mnesia/rabbit@deb2ec87ffa7/DECISION_TAB.LOG
Normal file
Binary file not shown.
BIN
queue/data/mnesia/rabbit@deb2ec87ffa7/LATEST.LOG
Normal file
BIN
queue/data/mnesia/rabbit@deb2ec87ffa7/LATEST.LOG
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
{[rabbit@deb2ec87ffa7],[rabbit@deb2ec87ffa7]}.
|
@ -0,0 +1 @@
|
|||||||
|
RAWA
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
%% This file is auto-generated! Edit at your own risk!
|
||||||
|
{segment_entry_count, 2048}.
|
@ -0,0 +1 @@
|
|||||||
|
/
|
@ -0,0 +1,2 @@
|
|||||||
|
{client_refs,[]}.
|
||||||
|
{index_module,rabbit_msg_store_ets_index}.
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
{client_refs,[]}.
|
||||||
|
{index_module,rabbit_msg_store_ets_index}.
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
VHOST: /
|
||||||
|
QUEUE: B
|
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
VHOST: /
|
||||||
|
QUEUE: AllInfo
|
@ -0,0 +1,2 @@
|
|||||||
|
VHOST: /
|
||||||
|
QUEUE: C
|
Binary file not shown.
Binary file not shown.
1
queue/data/mnesia/rabbit@deb2ec87ffa7/node-type.txt
Normal file
1
queue/data/mnesia/rabbit@deb2ec87ffa7/node-type.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
disc.
|
@ -0,0 +1 @@
|
|||||||
|
[rabbit@deb2ec87ffa7].
|
@ -0,0 +1 @@
|
|||||||
|
RAWA
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
cXM
|
@ -0,0 +1 @@
|
|||||||
|
cXM
|
Binary file not shown.
1
queue/data/mnesia/rabbit@deb2ec87ffa7/rabbit_serial
Normal file
1
queue/data/mnesia/rabbit@deb2ec87ffa7/rabbit_serial
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.
|
@ -0,0 +1 @@
|
|||||||
|
cXM
|
1
queue/data/mnesia/rabbit@deb2ec87ffa7/rabbit_user.DCD
Normal file
1
queue/data/mnesia/rabbit@deb2ec87ffa7/rabbit_user.DCD
Normal file
@ -0,0 +1 @@
|
|||||||
|
cXM
|
BIN
queue/data/mnesia/rabbit@deb2ec87ffa7/rabbit_user.DCL
Normal file
BIN
queue/data/mnesia/rabbit@deb2ec87ffa7/rabbit_user.DCL
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
cXM
|
BIN
queue/data/mnesia/rabbit@deb2ec87ffa7/rabbit_user_permission.DCL
Normal file
BIN
queue/data/mnesia/rabbit@deb2ec87ffa7/rabbit_user_permission.DCL
Normal file
Binary file not shown.
1
queue/data/mnesia/rabbit@deb2ec87ffa7/rabbit_vhost.DCD
Normal file
1
queue/data/mnesia/rabbit@deb2ec87ffa7/rabbit_vhost.DCD
Normal file
@ -0,0 +1 @@
|
|||||||
|
cXM
|
BIN
queue/data/mnesia/rabbit@deb2ec87ffa7/rabbit_vhost.DCL
Normal file
BIN
queue/data/mnesia/rabbit@deb2ec87ffa7/rabbit_vhost.DCL
Normal file
Binary file not shown.
BIN
queue/data/mnesia/rabbit@deb2ec87ffa7/schema.DAT
Normal file
BIN
queue/data/mnesia/rabbit@deb2ec87ffa7/schema.DAT
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user