首页 文章

使用Spring集成执行程序通道时超出GC超限

提问于
浏览
1
I have got the below exception , I suspect heap memory is full so GC exception was thrown . Kindly explain if any other perspective for the below application solution


  2017:06:07 21:18:36.275 [loginputtaskexecutor-7] ERROR o.s.i.handler.LoggingHandler - org.springframework.messaging.MessageHandlingException: nested exception is java.lang.IllegalStateException: Cannot process message
    at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:96)
    at org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:89)
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
    at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.access$000(UnicastingDispatcher.java:53)
    at org.springframework.integration.dispatcher.UnicastingDispatcher$3.run(UnicastingDispatcher.java:129)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:55)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Cannot process message
    at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:333)
    at org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:155)
    at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:93)
    ... 11 more
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded


  **Application flow in detail :**

Spring集成应用程序构建用于监听来自ActiveMQ的消息,在消费来自ActiveMQ的消息之后,它将被移交给具有订户作为服务激活器的输入通道(Executor通道) . 在Service Activator中,消息转换为json,然后存储到Cassandra . 服务激活方法中提到了@ transaction .

通过上面的解决方案,我想通过实现 Actuator 通道来打破消息事务流,消息消耗后它将被移交给 Actuator 通道并且事务结束 . 之后,执行程序通道中的线程将负责执行对cassandra的并行写入 .

有没有更好的方法使用java spring集成尽可能快地将大量数据写入casandra

1 回答

  • 1

    如果数据接收器无法跟上,请在TaskExecutor中添加队列大小限制,并在队列已满时使用 CallerRunsPolicyCallerBlocksPolicy .

    这将自然地以接收器可以处理的速率限制工作量 .

相关问题