Skip to content

As a library user I want to consume messages from a stream #35

@l4mby

Description

@l4mby

The user should be able to create a consumer attached to a stream

const consumer = await connection.createConsumer({ 
    stream: { 
         name: "some-stream", 
         offset: Offset.first() 
    },
    messageHandler: (msg) => /* ... */
})

The user should also be able to add stream filtering

const consumer = await connection.createConsumer({ 
  stream: { 
       name: "some-stream", 
       offset: Offset.first(),
       filterValues: ["invoices", "orders"],
       matchUnfiltered: true
  },
  messageHandler: (context, msg) => {
                  const filterValue = msg.annotations("x-stream-filter-value")
                  if (["invoices", "orders"].includes(filterValue) {
                          // process message ....
                  }
         }
   })

Metadata

Metadata

Assignees

Labels

todoNext feature to implement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions