Spring Boot Microservice will consume external job


#1

Hi,

I try to have a Microservice that will communicate (consuming) with the processing engine (seperate service). it is currently defined as external task, how should i implement this in java? does i have to write “fetchAndLock” Rest polling self, or is there an other solution for java <> java process intercommunication over camunda.

regards

enrico


#2

Hi Enrico.

Currently you have to use the REST API for this. We are working on a Java client for the next release (7.9, end of May), see https://camunda.com/learn/community/#roadmap.

Another possibility would be to start an own engine within your Spring Microservice and connect to the same database. This way you can easily leverage the normal Java API. But it is probably too tightly coupled from an architectural point of view. I wanted to bring it on the table anyway :slight_smile:

Cheers
Bernd


#3

You could check out the camunda-bpm-camel extension and its external task feature, see https://github.com/camunda/camunda-bpm-camel#camunda-bpmpoll-externaltasks-consuming-external-tasks

I did not work with it myself, but am currently investigating camel a lot, and it seems to be a great option for this kind of problem.


#4

Hi, i think also with AMQP or Kafka it will work. Thx


#5

Definitely does, see e.g. https://github.com/berndruecker/camunda-spring-boot-amqp-microservice-cloud-example/


#6

Hi @BerndRuecker,

good to hear this. Is there also an “Golang” client planed? What i can do is generate from the Swagger Specification an SDK but this is not realy lightweight and does not handle the long term polling feature.

Is it also planed to support streaming over HTTP (WebFlux) ?

regards

Enrico


#7

Hi Enrico.

we do not yet have a GoLang client on the near-term roadmap. I could envision that we will do it rather soon - but no commitment so far. Good to know that you would love to see it! Within https://zeebe.io/ (a completly new engine) we started with Java and GoLang - so we definitely see the use case.

Cheers
Bernd


#8

Hi @BerndRuecker

In the example you presented, its not clear to me how the Process Instance ReceiveTask is correctly targeted.

In the case of 2 process instances, it seems that some kind of correlation key is missing, in order to know which Process Instance to invoke.

Thanks, Conor.


#9

It is handled by using a business id (order id) like e.g. here: https://github.com/berndruecker/camunda-spring-boot-amqp-microservice-cloud-example/blob/master/src/main/java/com/camunda/demo/springboot/adapter/AmqpReceiver.java#L47. Probably not always the best choice, artifical correlation ids might work better, see an example here https://github.com/flowing/flowing-retail/blob/master/order/src/main/java/io/flowing/retail/order/port/message/MessageListener.java#L77

Does this help?


#10

Hi @BerndRuecker,

i still recognize zeebe.io. This sounds very cool, but for mass data driven we decide to use “spring cloud data flow”.

But i will follow zeebe.io for the future.

regards
Enrico


#11

Yes, I agree that synthetic correlation ids are really the only way to do it (at least in this case)

Some kind of token must be either supplied or generated, otherwise you are immediately into a more complex scenario,

I noticed in the example from retail flowing, that you are using a trace id, this looks like potential option. not sure about using it as a business key thought :slight_smile:

Thanks, Conor.