newscred / webhook-broker

This is a fully HTTP based Pub/Sub Broker with a goal to simplify system architecture in SOA or Microservice architecture. It aims to solve the inter service communication problem.
Apache License 2.0
18 stars 25 forks source link

AR-292: Add POST endpoint for pull based consumer #143

Closed RedwanPlague closed 1 year ago

RedwanPlague commented 1 year ago

Ticket: AR-292

Description

Add POST /channel/{channel-id}/consumer/{consumer-id}/job/{job-id} endpoint

The endpoint requires the X-Broker-Channel-Token and X-Broker-Consumer-Token headers and a body of the form:

{
    "NextState": "INFLIGHT"/"DELIVERED"/"DEAD"
}

Allowed transitions are: JobQueued -> JobInflight JobInflight -> JobDelivered JobInflight -> JobDead JobDead -> JobInflight (this transition increases job.RetryAttemptCount by 1)

If the current job status and requested next job status are the same, a 202 Accepted response will be given with no DB change.

All other transitions are invalid and will get a 400 Bad Request response.

RedwanPlague commented 1 year ago

This PR was merged into https://github.com/newscred/webhook-broker/pull/141

imyousuf commented 1 year ago

Addresses part of #53