java - How do I treat JMS queue as a temporary storage? -
i want able pull , insert messages , queue. possible leverage jms features this, or should need create custom data structure this?
please let me know if there other specific design pattern temporary storage.
update: since many asking more detail, here is. requirement store message in queue multiple clients can push data to, , pull data , when required. queue should available multiple clients. 1 message should processed once , if client not able process data message should return queue.
it seems asking multiple things in 1 question, might benefit clarify little individual points need answered.
yes, possible have jms used 'temporary' storage, depends on mean , need. jms providers (such activemq) allow following things on queues:
- set queue durable (i.e. store on disk , if queue gets restarted messages there) or non-durable (i.e. not store on disk , if queue gets restarted there no messages).
- you can set expiry time on messages, if not picked on time discarded.
this depends on referring 'temporary storage'. jms queue not database, messaging system.
regarding data structures, can serialize both normal java objects in objectmessage , text messages textmessage. can pass through xml, json, csv or whatever want. can include special headers can use routing or other meta-information associated message. again depends on mean 'custom data structure'. can send raw bytesmessage, or mapmessage (key-value pairs), or streammessage different data types inside 1 after other.
if need temporary storage in literal sense, maybe should @ embedded databases such derby or hsqldb. think have configurations state whether data should stay in memory or go disk after gets large.
Comments
Post a Comment