Jobworker inside a method to get rest call and return the response

Hi,
I am very new to zeebe and currenctly working on SpringBoot with zeebe.
I have put the jobworker inside a method and made a rest call , I want the response to be returned from the method.How can I do that??Since I an using this with hystrix i want it to return string or object so that i can get my fallback method executed.

hi @Lalita that sounds more like a Java question than a Zeebe question to me…
You need to return PaymentDetails response right?

@salaboy…Yes but since I am inside handler it can be return inside that block. But in my case i want to return inside a method.

@lalita I think that you are failing to understand that when registering a worker you are defining a callback lamba function. That will be called asynchronously so your method paymentService() is never going to be called as it is coded in your screenshot. The only purpose for that method is to register the worker callback.

Usually what you should do is to create another class to encapsulate your PaymentService (and the rest call) with that method marked with Hystrix, and then from inside the worker you call that class. Then you just initialise the worker code when you start your application, once. I hope that makes some sense…
If you share your code in a GitHub repo I can give you more pointers.

Cheers