I'm trying to post data(payload) from BitBucket to my Kafka instance in case of any BitBucket events (like Pushed
, Forked
, PR creating
, Addition
/Modification
/Deletion
of PR comments etc.)
So, I've setup Kafka rest-proxy but I can't send data from BitBucket to Kafka as the Content-Type
required to post data using the Kafka REST proxy is application/vnd.kafka.json.v2+json
and BitBucket's payload has an header set as application/json
(I'm using the default BitBucket webhook configured at the Repository
level).
I've configured the Webhook at the repository level is this way:
This is the request which is being triggered from BitBucket's Webhook:
And the response I get from Kafka's REST Proxy is this:
I've thought about the following solutions:
I can write a simple web server which acts as a mediator between the two systems (BitBucket and Kafka). The server can act as an intermediate proxy and grab incoming requests from BitBucket's webhook and post it to
Kafka REST proxy
using the appropriate header (application/vnd.kafka.json.v2+json
).This solution works but the downsides are maintenance of another server (written by me). Also, it can have scalability woes as BitBucket starts triggering webhooks frequently (100s per second during peak hours as we've only one BitBucket instance and we've around 3500 developers).
I can use a BitBucket plugin which works as a
webhook
and which allows me to configure and change headers on the fly. This is the solution which I'm thriving to achieve. Doesn't involve an extra server to be maintained as well.
Is there a BitBucket plugin, which I can install from the market place which will enable me to configure the header when the webhook is triggered?
P.S. - Apologies for writing such a long question. These two solutions are just from the top off my head. I won't be surprised if a better solution is available to integrate BitBucket with Kafka. Also, please do let me know if the question stands unclear. In that case, I'll try to clarify my question in a different manner.
Thanks