Amazon SQS - JMS vs custom implementation -
currently reading sqs
queue following code
public class sqsreceiver implements runnable { @autowired protected amazonsqs sqs; protected receivemessagerequest receivemessagerequest; public void run() { list<message> messages = sqs.receivemessage(receivemessagerequest) .getmessages(); (message msg : messages) { logger.info("processing message: {}", msg.getbody()); try { processmessage(msg); } catch (exception e) { logger.error("error processing message", e); } { sqs.deletemessage(new deletemessagerequest().withqueueurl( receivemessagerequest.getqueueurl()).withreceipthandle( msg.getreceipthandle())); } } } }
and having scheduler read every second:
threadpooltaskscheduler scheduler = new threadpooltaskscheduler(); scheduler.setpoolsize(1); scheduler.initialize(); scheduler.schedule(sqsreceiver, new crontrigger("* * * * * *"));
but recently, learned amazon released using jms amazon sqs. wondering besides having code independent underlying implementation, benefits there in terms of performance , costs in switching implementation use jms
?
Comments
Post a Comment