GoogleCloudPlatform/spring-cloud-gcp
View on GitHubPubSubInboundChannelAdapter does not allow null payload
Open
#963 opened on Feb 24, 2022
awaitinggood first issuepriority: p3pubsubtype: enhancement
Repository metrics
- Stars
- (547 stars)
- PR merge metrics
- (PR metrics pending)
Description
Hello, I would like to ask, if there is any possibility to receive message with empty payload via PubSubInboundChannelAdapter? It seems to me that this is impossible, however that is perfectly valid scenario in gcp pubsub.
java.lang.IllegalArgumentException: payload must not be null
at org.springframework.util.Assert.notNull(Assert.java:201)
at org.springframework.integration.support.MessageBuilder.<init>(MessageBuilder.java:70)
at org.springframework.integration.support.MessageBuilder.withPayload(MessageBuilder.java:114)
at org.springframework.integration.support.DefaultMessageBuilderFactory.withPayload(DefaultMessageBuilderFactory.java:72)
at org.springframework.integration.support.DefaultMessageBuilderFactory.withPayload(DefaultMessageBuilderFactory.java:31)
at com.google.cloud.spring.pubsub.integration.inbound.PubSubInboundChannelAdapter.consumeMessage(PubSubInboundChannelAdapter.java:146)
at com.google.cloud.spring.pubsub.core.subscriber.PubSubSubscriberTemplate.lambda$subscribeAndConvert$1(PubSubSubscriberTemplate.java:173)
at com.google.cloud.pubsub.v1.MessageDispatcher$4.run(MessageDispatcher.java:396)
at com.google.cloud.pubsub.v1.SequentialExecutorService$AutoExecutor$1.run(SequentialExecutorService.java:134)
at com.google.cloud.pubsub.v1.SequentialExecutorService$SequentialExecutor$1.run(SequentialExecutorService.java:112)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)