3 Replies Latest reply on Feb 28, 2012 7:22 AM by Claus Ibsen

    How to remove message's from a vm endpoint  ?

    san red Newbie

      Hi,

       

      i have a scenario where message's are getting accumulated in a vm endpoint due to slow consumers . I want to remove this old message's and process only new one's at regular intervals on reaching a threshold  .How can i do this ?

       

      i have recreated the scenario using a simple route like below , where i have made consumers intentionally slow such that message accumulation happens

       

      <route id="route1">

      <from uri="timer://Timer?period=1000" />

      <to uri="bean:producer?method=send" />

      <to uri="vm:simpleEp" />

      </route>

       

      <route id="route2">

      <from uri="vm:simpleEp" />

      <to uri="bean:consumer?method=recv" />

      </route>

       

       

       

       

      i have tried getting the endpoint and starting/stopping it such that it will delete the pending message's like below code  but its not working

       

      ApplicationContextProvider.getCamelContext().getEndpoint("vm:vm:simpleEp").stop()/start()

       

       

       

       

       

      Is there a way to do this from camelcontext ? if not is there a jmx alternative ?

       

       

       

       

       

      Thanks

       

       

      sanre6