architecture - CometD: publish from external server -


i trying understand use cases / architecture of typical users of cometd see if on right track. here diagram describing our intended use.

cometd web services

we have cometd server more of event pub/sub our web services, no content pass through cometd, event data. web services can publish events clients based on action process or can happen long running process / scheduled process.

my questions based on java client:

  • is appropriate use of cometd java client? documentation seems java client used short term life applications desktop apps.
  • given java client cometd, should have single instance or pool of clients handle sending events cometd web service instance?
  • the client code seems elaborate enough handle batching messages , multiple threads calling , seems establishing client expensive on fly when needed publish 1 message, correct?

thank time!

yes, appropriate use of cometd java client.

you can have single instance of cometd java client, safe multi-threaded usage, or can have 1 cometd java client each web service, recommended approach (as can identify in cometd server web service sent what).

note cometd java client asynchronous.

if need reply or confirmation message sent processed cometd server, need able suspend web service request (via httpservletrequest.startasync() or similar), invoke cometd java client, , when message confirmation arrange complete web service response client.

you can confirmations using callbacks in cometd java client apis, see cometd java client api documentation.

for completeness, if use broadcast channel publish message web service, message re-broadcast remote clients cometd server.

on other hand, if use service channel publish message web service, able process message on cometd server (and perhaps enrich or drop following business logic) before having opportunity re-broadcast or send specific client.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -