Skip to content

Commit

Permalink
Allow change visibility of messages
Browse files Browse the repository at this point in the history
  • Loading branch information
notVitaliy committed Dec 25, 2020
1 parent aff719b commit 47f9268
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magic8bot/smq",
"version": "2.0.1",
"version": "2.1.0",
"description": "Cryptocurrency trading bot",
"bugs": "https://github.com/magic8bot/smq/issues",
"license": "MIT",
Expand Down
10 changes: 7 additions & 3 deletions src/smq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ export class Smq {
return rsmq.sendMessageAsync({ qname, message: JSON.stringify(message) })
}

async receiveMessage<T>(qname: Channel): Promise<T | false> {
const { message } = (await rsmq.receiveMessageAsync({ qname })) as RedisSMQ.QueueMessage
async receiveMessage<T>(qname: Channel): Promise<{ id: string; message: T | false }> {
const { id, message } = (await rsmq.receiveMessageAsync({ qname })) as RedisSMQ.QueueMessage

return this.decode(message)
return { id, message: this.decode(message) }
}

changeMessageVisibility(qname: string, id: string, vt: number) {
return rsmq.changeMessageVisibilityAsync({ qname, id, vt })
}

deleteMessage(qname: Channel, id: string) {
Expand Down

0 comments on commit 47f9268

Please sign in to comment.