Couple Questions

Just working through the example, when I’m reading an item from the queue (i.e. streams/newstream/0) the item stays in the queue - using DELETE at the item-id level does not appear to work, so a couple questions:

  1. How do you remove item “0” from streams/newstream - or am I just doing it wrong?

  2. The “subscriber” example is just polling - does Event Source support a push model for notifying workers as the queue has new items added or is polling the only supported approach out of the box?

  3. What is the recommended pattern for data consistency - i.e. how do I ensure that if a client consumes an item from the queue but crashes, the work does not become lost?

Looks really straight forward and nice, looking forward to working with Event Store in the future :).

If you are trying to treat it as a queue then you should use the
competing consumer http api not reading from streams over atom (they
are very similar but competing consumers allows multiple clients and
handles timeouts/retries etc).

Cheers,

Greg

Hi,

As a related question, if I'm using competing consumers and autoAc is set to true, when does the acknowledgement occur? How does this effect consumers that may crash?
Cheers
Sean.

If autoack is set to true it occurs as soon as your handler returns.
In terms of how it affects consumers it depends on what your consumer
does, if it processes synchronously the message will be retried either
when the connection fails (if a fail is seen) or when the timeout
expires.

Hi Greg,

Thanks, so when would you set autoAc to false? If I do this, what do I need to call to acknowledge a message?
Cheers
Sean.

there is an acknowledge method
https://github.com/EventStore/EventStore/blob/release-v4.0.0/src/EventStore.ClientAPI/EventStorePersistentSubscriptionBase.cs#L90

Thanks Greg - pardon if I’ve missed the obvious but is there a sample code snippet to show this use case in action?

The http competing consumer API?

http://docs.geteventstore.com/http-api/3.9.0/competing-consumers/
shows the http flow using curl (scroll down to reading stream).

That’ll do - thanks again :slight_smile:

Main thing is to have the consumer post to the rel link:

        {
          "uri":
"http://localhost:2113/subscriptions/newstream/competing_consumers_group1/ack/c322e299-cb73-4b47-97c5-5054f920746f",
          "relation": "ack"
        },

This will acknowledge the message. If the message has not been acked
based on configuraiton settings of the subscription (see competing
consumers server docs) the message will become eligible to be read
again.

This will also work with N consumers over http. You can also monitor
the status of the subscription (how far consumers are etc) either via
the dashboard or via the http uri to the subscription.

Cheers,

Greg

Greg - how are you expecting that auth is handled in the request - I’m trying to create a stream via Postman and getting the response (401) - Basic auth doesn’t seem to be supported, so is there a particular form for Authorization we’re using (i.e. :)?

PUT /subscriptions/newstream/test HTTP/1.1

Host: 127.0.0.1:2113

Content-Type: application/json

Authorization: admin:changeit

Cache-Control: no-cache

Postman-Token: 0ac402b6-e2d8-1551-04d7-0f78ae5784f4

Thanks,

Chris

basic auth is supported why are you doing a put?

From the docs:http://docs.geteventstore.com/http-api/3.9.0/competing-consumers/

/subscriptions/{stream}/{subscription_name}
application/json
PUT

Would you be able to paste a request header as an example - using basic auth gets me a 500 ISE .

Ok this works - using url encoded name/pwd instead of Authorization header seems to work fine anyhow.

Ah I read the uri wrong … yes that is a put to create the subscription.

Basic auth should work (curl etc doesn’t have an issue)