@@ -10,7 +10,6 @@ each run in an isolated process. It has the ability to collect statistical
1010data from the consumer processes and report on it.
1111
1212[ ![ Version] ( https://img.shields.io/pypi/v/rejected.svg? )] ( https://pypi.python.org/pypi/rejected )
13- [ ![ Coverage] ( https://img.shields.io/codecov/c/github/gmr/rejected.svg? )] ( https://codecov.io/github/gmr/rejected?branch=main )
1413[ ![ License] ( https://img.shields.io/pypi/l/rejected.svg? )] ( https://github.com/gmr/rejected/blob/main/LICENSE )
1514
1615## Features
@@ -30,6 +29,7 @@ pip install rejected
3029For optional features:
3130
3231``` bash
32+ pip install rejected[avro] # Avro support
3333pip install rejected[html] # HTML message body support
3434pip install rejected[msgpack] # MessagePack support
3535```
@@ -49,37 +49,6 @@ LOGGER = logging.getLogger(__name__)
4949
5050class Test (consumer .Consumer ):
5151
52- def process (self , message ) :
53- LOGGER .debug(' In Test.process: %s ' , message .body)
52+ async def process (self ) -> None :
53+ LOGGER .debug(' In Test.process: %s ' , self .body)
5454```
55-
56- ## Async Consumer
57-
58- To make a consumer async, you can use Tornado's ` @gen.coroutine ` decorator on the
59- ` Consumer.prepare ` and ` Consumer.process ` methods. Asynchronous consumers allow
60- you to use async clients like Tornado's ` AsyncHTTPClient ` to perform parallel
61- tasks when processing a single message.
62-
63- ``` python
64- import logging
65-
66- from rejected import consumer
67-
68- from tornado import gen
69- from tornado import httpclient
70-
71-
72- class AsyncExampleConsumer (consumer .Consumer ):
73-
74- @gen.coroutine
75- def process (self ):
76- LOGGER .debug(' Message: %r ' , self .body)
77- http_client = httpclient.AsyncHTTPClient()
78- results = yield [http_client.fetch(' http://www.github.com' ),
79- http_client.fetch(' http://www.reddit.com' )]
80- LOGGER .info(' Length: %r ' , [len (r.body) for r in results])
81- ```
82-
83- ## Version History
84-
85- See [ HISTORY.md] ( HISTORY.md ) or the [ documentation] ( https://rejected.readthedocs.io ) .
0 commit comments