Results 1 to 8 of 8

Thread: Asynchronous polling------has no eligible methods for handling Messages

  1. #1
    Join Date
    Sep 2011
    Posts
    7

    Question Asynchronous polling------has no eligible methods for handling Messages

    I have a question about Asynchronous polling..

    Configuration:

    <task:annotation-driven executor="taskExecutor" />

    <gateway id="outMaterial" service-interface="com.spg.integration.stock.StockOut"/>

    <channel id="stockout"/>
    <filter input-channel="stockout" output-channel="stockoutpass"
    ref="stockOutService" method="filterTransaction"/>

    <channel id="stockoutpass">
    <queue capacity="5"/>

    </channel>
    <service-activator input-channel="stockoutpass" ref="stockOutService" method="doSomething">
    <poller receive-timeout="5000" task-executor="taskExecutor" fixed-rate="50"/>
    </service-activator>
    <task:executor id="taskExecutor" pool-size="20" queue-capacity="20" />


    StockOutService.java :

    @Service
    @Transactional
    public class StockOutService {

    private static Logger logger = LoggerFactory
    .getLogger(StockOutService.class);

    @Autowired
    private MpsManager mpsManager;

    public boolean filterTransaction(MaterialDeliveryDetails entity) {
    .........
    logger.info("entity: " + entity.getMainid());
    return ts == null ? false : true;

    }

    @Async
    void doSomething(MaterialDeliveryDetails entity)
    throws MultiXmlException {
    MaterialDeliveryOrder md = materialDeliveryManager
    .getMaterialDeliveryOrder((long) entity.getOrderId());
    ....

    }

    }

    I use @Async Annotation as spring3 ,but has a wrong code:

    Caused by: java.lang.IllegalArgumentException: Target object of type [class com.spg.integration.stock.StockOutService$$Enhance rByCGLIB$$4f4875da] has no eligible methods for handling Messages.
    at org.springframework.util.Assert.notEmpty(Assert.ja va:294)
    at org.springframework.integration.util.MessagingMeth odInvokerHelper.findHandlerMethodsForTarget(Messag ingMethodInvokerHelper.java:350)
    at org.springframework.integration.util.MessagingMeth odInvokerHelper.<init>(MessagingMethodInvokerHelpe r.java:167)
    at org.springframework.integration.util.MessagingMeth odInvokerHelper.<init>(MessagingMethodInvokerHelpe r.java:105)
    at org.springframework.integration.util.MessagingMeth odInvokerHelper.<init>(MessagingMethodInvokerHelpe r.java:109)
    at org.springframework.integration.handler.MethodInvo kingMessageProcessor.<init>(MethodInvokingMessageP rocessor.java:48)
    at org.springframework.integration.handler.ServiceAct ivatingHandler.<init>(ServiceActivatingHandler.jav a:42)
    at org.springframework.integration.config.ServiceActi vatorFactoryBean.createMethodInvokingHandler(Servi ceActivatorFactoryBean.java:48)
    at org.springframework.integration.config.AbstractSta ndardMessageHandlerFactoryBean.createHandler(Abstr actStandardMessageHandlerFactoryBean.java:72)
    at org.springframework.integration.config.AbstractSim pleMessageHandlerFactoryBean.createHandlerInternal (AbstractSimpleMessageHandlerFactoryBean.java:89)
    at org.springframework.integration.config.AbstractSim pleMessageHandlerFactoryBean.getObject(AbstractSim pleMessageHandlerFactoryBean.java:68)
    at org.springframework.integration.config.AbstractSim pleMessageHandlerFactoryBean.getObject(AbstractSim pleMessageHandlerFactoryBean.java:31)
    at org.springframework.beans.factory.support.FactoryB eanRegistrySupport.doGetObjectFromFactoryBean(Fact oryBeanRegistrySupport.java:142)
    ... 35 more

    Is it spring Execution or spring integration program? what should I do?Could you give me a example about Asynchronous

  2. #2
    Join Date
    Sep 2011
    Posts
    7

    Default

    Someone can help me?Spring integration support spring 3 Annotation @Async? If My task implements Runnable,Service into an infinite loop.How do I!!!

  3. #3
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

  4. #4
    Join Date
    Sep 2011
    Posts
    7

    Default

    I had read the Reference about async-polling and async-gateway. I think async-polling is a good method. I want to do something with a third system .It's slow and Connection limit.But github hasn't example about async-polling. Reference is too sample.


    <int:service-activator input-channel="publishChannel" ref="myService">
    <intoller receive-timeout="5000" task-executor="taskExecutor" fixed-rate="50"/>
    </si:service-activator>

    <task:executor id="taskExecutor" pool-size="20" queue-capacity="20"/>


    Can you give me an example of "myService".I think "myService" should be Special and Asynchronous.
    Last edited by demohawk; Sep 13th, 2011 at 09:02 AM.

  5. #5
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Polling is always asynchronous from the perspective of the message sender since messages are polled from the QueueChannel by a different thread (poller thread) In your configuration you also adding task executor so the poller can use its thread poll. What you have configured is perfectly valid. Any messages that comes to 'publishChannel' will be polled by this poller. I guess I am missing the question

  6. #6
    Join Date
    Sep 2011
    Posts
    7

    Default

    I created a generic class and method as my service.But when I start Tomcat, but get a wrong loop:

    ...
    2011-09-14 10:35:00,865 [task-scheduler-2] ERROR [org.springframework.integration.handler.LoggingHan dler] - org.springframework.core.task.TaskRejectedExceptio n: Executor [java.util.concurrent.ThreadPoolExecutor@1476566] did not accept task: org.springframework.integration.util.ErrorHandling TaskExecutor$1@521466
    at org.springframework.scheduling.concurrent.ThreadPo olTaskExecutor.execute(ThreadPoolTaskExecutor.java :244)
    at org.springframework.integration.util.ErrorHandling TaskExecutor.execute(ErrorHandlingTaskExecutor.jav a:49)
    at org.springframework.integration.endpoint.AbstractP ollingEndpoint$Poller.run(AbstractPollingEndpoint. java:202)
    at org.springframework.scheduling.support.DelegatingE rrorHandlingRunnable.run(DelegatingErrorHandlingRu nnable.java:51)
    at org.springframework.scheduling.concurrent.Reschedu lingRunnable.run(ReschedulingRunnable.java:81)
    at java.util.concurrent.Executors$RunnableAdapter.cal l(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:138)
    at java.util.concurrent.ScheduledThreadPoolExecutor$S cheduledFutureTask.access$301(ScheduledThreadPoolE xecutor.java:98)
    at java.util.concurrent.ScheduledThreadPoolExecutor$S cheduledFutureTask.run(ScheduledThreadPoolExecutor .java:206)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: java.util.concurrent.RejectedExecutionException
    at java.util.concurrent.ThreadPoolExecutor$AbortPolic y.rejectedExecution(ThreadPoolExecutor.java:1768)
    at java.util.concurrent.ThreadPoolExecutor.reject(Thr eadPoolExecutor.java:767)
    at java.util.concurrent.ThreadPoolExecutor.execute(Th readPoolExecutor.java:658)
    at org.springframework.scheduling.concurrent.ThreadPo olTaskExecutor.execute(ThreadPoolTaskExecutor.java :241)
    ... 12 more

    2011-09-14 10:35:00,881 [task-scheduler-7] ERROR [org.springframework.integration.handler.LoggingHan dler] - org.springframework.core.task.TaskRejectedExceptio n: Executor [java.util.concurrent.ThreadPoolExecutor@1476566] did not accept task: org.springframework.integration.util.ErrorHandling TaskExecutor$1@106af1e
    at org.springframework.scheduling.concurrent.ThreadPo olTaskExecutor.execute(ThreadPoolTaskExecutor.java :244)
    at org.springframework.integration.util.ErrorHandling TaskExecutor.execute(ErrorHandlingTaskExecutor.jav a:49)
    at org.springframework.integration.endpoint.AbstractP ollingEndpoint$Poller.run(AbstractPollingEndpoint. java:202)
    at org.springframework.scheduling.support.DelegatingE rrorHandlingRunnable.run(DelegatingErrorHandlingRu nnable.java:51)
    at org.springframework.scheduling.concurrent.Reschedu lingRunnable.run(ReschedulingRunnable.java:81)
    at java.util.concurrent.Executors$RunnableAdapter.cal l(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:138)
    at java.util.concurrent.ScheduledThreadPoolExecutor$S cheduledFutureTask.access$301(ScheduledThreadPoolE xecutor.java:98)
    at java.util.concurrent.ScheduledThreadPoolExecutor$S cheduledFutureTask.run(ScheduledThreadPoolExecutor .java:206)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: java.util.concurrent.RejectedExecutionException
    at java.util.concurrent.ThreadPoolExecutor$AbortPolic y.rejectedExecution(ThreadPoolExecutor.java:1768)
    at java.util.concurrent.ThreadPoolExecutor.reject(Thr eadPoolExecutor.java:767)
    at java.util.concurrent.ThreadPoolExecutor.execute(Th readPoolExecutor.java:658)
    at org.springframework.scheduling.concurrent.ThreadPo olTaskExecutor.execute(ThreadPoolTaskExecutor.java :241)
    ... 12 more
    ...

    I don't know why.

  7. #7
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    can you show your task executor configuration?

  8. #8
    Join Date
    Sep 2011
    Posts
    7

    Default

    I have solved this problem.

    <service-activator input-channel="stockoutpass" ref="stockOutService" method="doSomething">
    <poller receive-timeout="5000" task-executor="taskExecutor" fixed-rate="50"/>
    </service-activator>
    <task:executor id="taskExecutor" pool-size="2" queue-capacity="20" rejection-policy="CALLER_RUNS"/>

    Need to configure a parameter of "CALLER_RUNS".

    https://jira.springsource.org/browse...nel#issue-tabs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •