服务空闲一段时间后,SCS生产者无法发送消息

时间:2019-12-16 02:28:12

标签: spring-kafka spring-cloud-stream

我正在运行SCS horsham和Spring启动应用程序。 YML给予

 spring:
  cloud:
    stream:
      kafka:
        binder:
          brokers: ${ESAAS_BROKER_SERVERS}
          configuration:
            sasl:
              mechanism: GSSAPI
            security:
              protocol: SASL_SSL
          headers: ActType
          jaas:
            options.useTicketCache: true
            options.renewTGT: true
            options.serviceName: esaas
            options.doNotPrompt: true
            options.krb: krb5.conf
            options.ticketCache: /app/ccache/ccache_a_test.crd
            options.principal: a_test@EXCHAD.NET
          auto-create-topics: false
          minPartitionCount: 20
          auto-add-partitions: false
          schema.registry.url: ${ESAAS_SCHEMA_REGISTRY_URL}
          commit.interval.ms: 1000
        bindings:
          edout:
            producer:
              configuration:
                client.id: edout
                schema.registry.url: ${ESAAS_SCHEMA_REGISTRY_URL}
                value.serializer: io.confluent.kafka.serializers.KafkaAvroSerializer
                key.serializer: org.apache.kafka.common.serialization.StringSerializer
   bindings:
    edout:
      producer:
        use-native-encoding: true
       destination: event-diary-request

服务在空闲状态下运行一段时间后,生产者将无法发送消息。引发以下异常

org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder$ProducerConfigurationMessageHandler@3bfc2616]; nested exception is org.apache.kafka.common.KafkaException: Failed to construct kafka producer
at org.springframework.integration.support.utils.IntegrationUtils.wrapInHandlingExceptionIfNecessary(IntegrationUtils.java:189) ~[spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:186) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder$SendingHandler.handleMessageInternal(AbstractMessageChannelBinder.java:925) ~[spring-cloud-stream-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:176) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:115) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:132) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:105) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:453) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:401) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at com.test.PublishService.sendAckNackToExplain(PublishService.java:89) ~[classes/:na]
at com.test.ActivityEventService.handleFailure(ActivityEventService.java:74) ~[classes/:na]
at com.test.ActivityEventService.lambda$processTradeEvent$10(ActivityEventService.java:61) ~[classes/:na]
at io.vavr.control.Try.onFailure(Try.java:659) ~[vavr-0.10.0.jar!/:na]
at com.test.ActivityEventService.processEvent(ActivityEventService.java:61) ~[classes/:na]
at com.jpmorgan.am.ibor.transaction.event.ActivityEventProcessor.streamListener(ActivityEventProcessor.java:54) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_221]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_221]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_221]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_221]
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:171) [spring-messaging-5.1.10.RELEASE.jar!/:5.1.10.RELEASE]
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:120) [spring-messaging-5.1.10.RELEASE.jar!/:5.1.10.RELEASE]
at org.springframework.cloud.stream.binding.StreamListenerMessageHandler.handleRequestMessage(StreamListenerMessageHandler.java:55) [spring-cloud-stream-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:123) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:176) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:115) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:132) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:105) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:453) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:401) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187) [spring-messaging-5.1.10.RELEASE.jar!/:5.1.10.RELEASE]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:166) [spring-messaging-5.1.10.RELEASE.jar!/:5.1.10.RELEASE]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47) [spring-messaging-5.1.10.RELEASE.jar!/:5.1.10.RELEASE]
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:109) [spring-messaging-5.1.10.RELEASE.jar!/:5.1.10.RELEASE]
at org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:205) [spring-integration-core-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.integration.kafka.inbound.KafkaMessageDrivenChannelAdapter.sendMessageIfAny(KafkaMessageDrivenChannelAdapter.java:369) [spring-integration-kafka-3.1.0.RELEASE.jar!/:3.1.0.RELEASE]
at org.springframework.integration.kafka.inbound.KafkaMessageDrivenChannelAdapter.access$400(KafkaMessageDrivenChannelAdapter.java:74) [spring-integration-kafka-3.1.0.RELEASE.jar!/:3.1.0.RELEASE]
at org.springframework.integration.kafka.inbound.KafkaMessageDrivenChannelAdapter$IntegrationRecordMessageListener.onMessage(KafkaMessageDrivenChannelAdapter.java:431) [spring-integration-kafka-3.1.0.RELEASE.jar!/:3.1.0.RELEASE]
at org.springframework.integration.kafka.inbound.KafkaMessageDrivenChannelAdapter$IntegrationRecordMessageListener.onMessage(KafkaMessageDrivenChannelAdapter.java:402) [spring-integration-kafka-3.1.0.RELEASE.jar!/:3.1.0.RELEASE]
at org.springframework.kafka.listener.adapter.RetryingMessageListenerAdapter.lambda$onMessage$0(RetryingMessageListenerAdapter.java:120) [spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287) ~[spring-retry-1.2.4.RELEASE.jar!/:na]
at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:211) ~[spring-retry-1.2.4.RELEASE.jar!/:na]
at org.springframework.kafka.listener.adapter.RetryingMessageListenerAdapter.onMessage(RetryingMessageListenerAdapter.java:114) [spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.kafka.listener.adapter.RetryingMessageListenerAdapter.onMessage(RetryingMessageListenerAdapter.java:40) [spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeOnMessage(KafkaMessageListenerContainer.java:1308) ~[spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeOnMessage(KafkaMessageListenerContainer.java:1291) ~[spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeRecordListener(KafkaMessageListenerContainer.java:1252) ~[spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeWithRecords(KafkaMessageListenerContainer.java:1233) ~[spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeRecordListener(KafkaMessageListenerContainer.java:1148) ~[spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeListener(KafkaMessageListenerContainer.java:958) ~[spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.pollAndInvoke(KafkaMessageListenerContainer.java:765) ~[spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:703) ~[spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_221]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_221]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_221]
Caused by: org.apache.kafka.common.KafkaException: Failed to construct kafka producer
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:457) ~[kafka-clients-2.0.1.jar!/:na]
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:289) ~[kafka-clients-2.0.1.jar!/:na]
at org.springframework.kafka.core.DefaultKafkaProducerFactory.createKafkaProducer(DefaultKafkaProducerFactory.java:325) ~[spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.kafka.core.DefaultKafkaProducerFactory.createProducer(DefaultKafkaProducerFactory.java:312) ~[spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.kafka.core.KafkaTemplate.getTheProducer(KafkaTemplate.java:472) ~[spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.kafka.core.KafkaTemplate.doSend(KafkaTemplate.java:402) ~[spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.kafka.core.KafkaTemplate.send(KafkaTemplate.java:242) ~[spring-kafka-2.2.9.RELEASE.jar!/:2.2.9.RELEASE]
at org.springframework.integration.kafka.outbound.KafkaProducerMessageHandler.handleRequestMessage(KafkaProducerMessageHandler.java:382) ~[spring-integration-kafka-3.1.0.RELEASE.jar!/:3.1.0.RELEASE]
... 54 common frames omitted
Caused by: java.lang.IllegalArgumentException: Could not find a 'KafkaClient' entry in the JAAS configuration. System property 'java.security.auth.login.config' is /home/vcap/tmp/kafka-client-jaas-config-placeholder3857650954397090104conf
at org.apache.kafka.common.security.JaasContext.defaultContext(JaasContext.java:133) ~[kafka-clients-2.0.1.jar!/:na]
at org.apache.kafka.common.security.JaasContext.load(JaasContext.java:98) ~[kafka-clients-2.0.1.jar!/:na]
at org.apache.kafka.common.security.JaasContext.loadClientContext(JaasContext.java:84) ~[kafka-clients-2.0.1.jar!/:na]
at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:119) ~[kafka-clients-2.0.1.jar!/:na]
at org.apache.kafka.common.network.ChannelBuilders.clientChannelBuilder(ChannelBuilders.java:65) ~[kafka-clients-2.0.1.jar!/:na]
at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:88) ~[kafka-clients-2.0.1.jar!/:na]
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:414) ~[kafka-clients-2.0.1.jar!/:na]
... 63 common frames omitted

但是,当服务退回时,将发布消息(而不是失败的消息)。请告知是否必须将任何生产者参数设置为自动重新连接。

0 个答案:

没有答案