Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there clean way to pass context data to @Asynchronous ejb call?

In wildfly I execute stateless ejb method asynchronously (it is mapped with @Asynchronous annotation). In the calling method I have some context information in thread local. What is the best way to pass this data to async method? I don't want to add additional parameter to async method signature.

like image 336
vinga Avatar asked Nov 09 '22 14:11

vinga


1 Answers

Essentially you have only 2 options:

  1. Passing value as a parameter
  2. Storing that value in some global place. Like static variable.

The first option is much cleaner and easier. Don't use the second one :)

like image 131
Nikem Avatar answered Nov 14 '22 21:11

Nikem