My container XML config:
<rabbit:listener-container
connection-factory="myConnectionFactory"
acknowledge="none"
concurrency="10"
requeue-rejected="false">
<rabbit:listener ref="myListener" queues="myQueue"/>
</rabbit:listener-container>
and myListener
is just a class
@Component("myListener")
public class MyListener implements MessageListener {
@Autowired
SomeDependency dependency;
....
}
I've specified concurrency="10"
in my XML. What does this mean exactly?
I've found some docs. They are not that helpful stating:
Specify the number of concurrent consumers to create. Default is 1.
What I am interested in is whether MyListener
has to be thread safe i.e.
- are there many instances created or single instance used by many threads?
- can I access instance fields w/o synchronization?
- is
SomeDependency dependency
instantiated once or for each thread/instance? - does
dependency
need to be thread safe?