Which one to choose Betweeen Spring scheduler and JMS ? And difference between them -
i using spring scheduler , jms, 1 better approach scheduling.
@service public class scheduledprocessor implements processor { private final atomicinteger counter = new atomicinteger(); @autowired private worker worker; @scheduled(fixeddelay = 30000) public void process() { system.out.println("processing next 10 @ " + new date()); (int = 0; < 10; i++) { worker.work(counter.incrementandget()); } } }
these solutions fundamentally different.
scheduled services kicked off every n milliseconds after last run , processes whatever available. it's not guaranteed process in timely manner , might not scale if amount of data process grows (and if processing has level of complexity).
i tend lean towards jms. first off, messages processed come in, pushed listener, rather being polled in service. second, if necessary can scale messages both horizontal , vertical, giving more knobs make sure actual processing doesn't overwhelm application.
basic question might be: requirements?
Comments
Post a Comment