java - Multi Threading vs JMS Queue for Asynchronous Logging -


requirement: log events page views , form submits. each page has ~1 second sla. application can have 100's of concurrent users @ time.

log events stored database.

solution: initial thought use async logging approach control returns application , logging happens in different thread (via spring's thread pool task executor).

however suggested using jms more robust approach. added work(setting-up queue(s), writing queue(s), reading queue(s)) required when using approach worthwhile?

what of best practices / things out (in production environment) when implementing this?

both approaches valid, 1 vulnerable if app unexpectedly stops. in first scenario, events yet written database lost. using persistent jms queue mean events read queue , persisted database upon restart.

of course, if db writes slower placing message of similar size on jms queue, may solving wrong problem?