External task as event

We are starting reviewing Camunda, we have a simple POC in place using external tasks coded in C#, works as expected but we want to get away from polling, any plans or features to have a external task subscribe to a topic and receive events when work is available?

Thanks for the help

In 7.9 there will be long polling

1 Like

@luis_trujillo something I also started to work on, was using vertx to provide a event bus/web socket connection, but was also thinking about routing the events into RMQ, Kafka, or amqp.

What would you preference be?

would be a implementation that extends with a new verticle: https://github.com/StephenOTT/camunda-vertx-plugin

RabbitMQ would be perfect for us, in fact as POC we created a middle service that fetch and lock pending external tasks, then we push a message into the service bus, is not ideal and just a dirty hack but the scaling of external tasks was perfect, we deployed all these service within a cluster with RMQ.

Thanks for the reply

@luis_trujillo take a look at this: External Tasks Pattern and Messaging: Best of both worlds

There is some discussion about Message queues vs usage of external tasks.

@luis_trujillo here is a quick example of using Vertx to give you a SockJS websocket that your applications can connect to:

The link goes to a specific verticle that deploys a example socket:

There is a working html file with the sockJS so you can easily test.

The overall plugin basically launches a Vertx.io instance as a Camunda Plugin, you can configure which verticles to deploy based on the YAML file (see the plugin readme).

So in this example we have:

        name: "Camunda External Task WebSocket Notifier"
        path: "/verticles/external-task-notifier-tcp/external-task-tcp.js"
            worker: false
            instances: 1
                topics: ""
                camunda_url: "http://"
                "lock_period": 1000

And those “config” values would be avaliable in the “external-task-tcp.js” verticle.

you can see here:

This is example of a To and From websocket where you can receive data and send it back using permitted addresses.

In practice you could write a small listener for new External Task parsing, or you just write a External Task Query using the processEngine variable that is exposed in the verticle (you have full access to the Java API of camunda through the processEngine variable.

So then you could setup one or more recurring queries that happen every N seconds (as per the example) and send their results over the eventBus / websocket.

Also if you wanted to scale this, you can just setup the actual websocket on another Vertx Instance and use the Event Bus: So the vertx instance in the Camunda PLugin would do the queries and pass the data into the bus, and other vertx instances outside of the Camunda plugin, would do the actual work and things like websockets, etc. You even get High Availability/failover + clustering on the vertx instances with this setup.

@luis_trujillo any progress?

Sorry for the late replied, i have one of my developers working on a POC, i will let you know by end of week the result