When is messaging (e.g. JMS) an alternative for multithreading?

前端 未结 6 2098
北恋
北恋 2021-01-05 15:13

I work on a data processing application in which concurrency is achieved by putting several units of work on a message queue that multiple instances of a message driven bean

6条回答
  •  执念已碎
    2021-01-05 15:43

    In an EJB container, actually, there is no alternative, since you're not allowed to create your own threads in an EJB container. JMS is doing all of that work for you, at a cost of running it through the queue processor. You could also create a Java Connector, which has a more intimate relationship with the container (and thus, can have threads), but it's a lot more work.

    If the overhead of using the JMS queue isn't having a performance impact, then it's the easiest solution.

提交回复
热议问题