Fast, easy to use client for EventStore
Project description
Photon Pump
===========
A TCP eventstore client in Python 3.6
```python
async def write_an_event():
async with photonpump.connect() as conn:
await conn.publish_event('pony_stream', 'pony.jumped', body={
'name': 'Applejack',
'height_m': 0.6
})
async def read_an_event(conn):
event = await conn.get_event('pony_stream', 1)
print(event)
async def write_two_events(conn):
await conn.publish('pony_stream', [
NewEvent('pony.jumped', body={
'name': 'Rainbow Colossus',
'height_m': 0.6
},
NewEvent('pony.jumped', body={
'name': 'Sunshine Carnivore',
'height_m': 1.12
})
])
async def read_two_events(conn):
events = await conn.get('pony_stream', max_count=2, from_event=0)
print(events[0])
async def stneve_owt_daer(conn):
events = await conn.get('pony_stream', direction=StreamDirection.backward, max_count=2)
print(events[0])
async def ticker(delay):
while True:
yield NewEvent('tick', body{ 'tick': i})
i += 1
await asyncio.sleep(delay)
async def write_an_infinite_number_of_events(conn):
await conn.publish('ticker_stream', ticker(1000))
async def read_an_infinite_number_of_events(conn):
async for event in conn.stream('ticker_stream'):
print(event)
```
Documentation
-------------
Documentation is available at http://photon-pump.readthedocs.io/en/latest/
## [0.3] - 2018-04-11
### Fixes
- `iter` properly supports iterating a stream in reverse.
### Breaking change
- `published_event` reversed order of type and stream
[0.3]: https://github.com/madecom/photon-pump/compare/v0.2.5...v0.3
[0.2.5]: https://github.com/madecom/photon-pump/compare/v0.2.4...v0.2.5
===========
A TCP eventstore client in Python 3.6
```python
async def write_an_event():
async with photonpump.connect() as conn:
await conn.publish_event('pony_stream', 'pony.jumped', body={
'name': 'Applejack',
'height_m': 0.6
})
async def read_an_event(conn):
event = await conn.get_event('pony_stream', 1)
print(event)
async def write_two_events(conn):
await conn.publish('pony_stream', [
NewEvent('pony.jumped', body={
'name': 'Rainbow Colossus',
'height_m': 0.6
},
NewEvent('pony.jumped', body={
'name': 'Sunshine Carnivore',
'height_m': 1.12
})
])
async def read_two_events(conn):
events = await conn.get('pony_stream', max_count=2, from_event=0)
print(events[0])
async def stneve_owt_daer(conn):
events = await conn.get('pony_stream', direction=StreamDirection.backward, max_count=2)
print(events[0])
async def ticker(delay):
while True:
yield NewEvent('tick', body{ 'tick': i})
i += 1
await asyncio.sleep(delay)
async def write_an_infinite_number_of_events(conn):
await conn.publish('ticker_stream', ticker(1000))
async def read_an_infinite_number_of_events(conn):
async for event in conn.stream('ticker_stream'):
print(event)
```
Documentation
-------------
Documentation is available at http://photon-pump.readthedocs.io/en/latest/
## [0.3] - 2018-04-11
### Fixes
- `iter` properly supports iterating a stream in reverse.
### Breaking change
- `published_event` reversed order of type and stream
[0.3]: https://github.com/madecom/photon-pump/compare/v0.2.5...v0.3
[0.2.5]: https://github.com/madecom/photon-pump/compare/v0.2.4...v0.2.5
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
photon-pump-0.3.0.tar.gz
(24.8 kB
view details)
File details
Details for the file photon-pump-0.3.0.tar.gz
.
File metadata
- Download URL: photon-pump-0.3.0.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e79961aa5413fa662b29b54b846388b15c62c666acaee271122cf9d2d56ce97 |
|
MD5 | 33f6bf2ff49ef5dd13ead87ff9f3c5a4 |
|
BLAKE2b-256 | bdc9ac4720eddf434cd8af212a5c00bff8782eb58f1820ec278f8731db34089c |