Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to get message time sent #248

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -926,19 +926,29 @@ await message.delay(delay_in_seconds)
```

### Get headers

Get headers per message

```python
headers = message.get_headers()
```

### Get message sequence number

Get message sequence number

```python
sequence_number = msg.get_sequence_number()
```

### Get message time sent

Get message time sent

```python
time_sent = msg.get_timesent()
```

### Destroying a Consumer

```python
Expand Down
8 changes: 8 additions & 0 deletions memphis/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ def get_sequence_number(self):
except Exception:
return

def get_timesent(self):
"""Get timestamp when the message was sent."""
try:
md = self.message.metadata()
return md.timestamp
except Exception:
return

async def delay(self, delay):
"""Delay and resend the message after delay seconds"""
if (
Expand Down