Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform GCP发布/订阅:确认截止日期不为';阅读信息时不工作_Google Cloud Platform_Google Cloud Pubsub - Fatal编程技术网

Google cloud platform GCP发布/订阅:确认截止日期不为';阅读信息时不工作

Google cloud platform GCP发布/订阅:确认截止日期不为';阅读信息时不工作,google-cloud-platform,google-cloud-pubsub,Google Cloud Platform,Google Cloud Pubsub,在GCP Pub Sub上创建订阅,并将“确认截止日期”设置为其最大值(600秒),我的java客户端在spring boot中每60秒接收一次消息,以防任务仍在运行 我们有一个与此非常相似的简单消费者: 我们需要执行每次可以运行几分钟的操作,但即使设置为600秒,如果60秒后任务仍未完成,消息也会再次到达 难道没有人经历过类似的事情吗? 谢谢 更新: 这些是主要的依赖关系: <parent> <groupId>org.springframework.boot

在GCP Pub Sub上创建订阅,并将“确认截止日期”设置为其最大值(600秒),我的java客户端在spring boot中每60秒接收一次消息,以防任务仍在运行

我们有一个与此非常相似的简单消费者:

我们需要执行每次可以运行几分钟的操作,但即使设置为600秒,如果60秒后任务仍未完成,消息也会再次到达

难道没有人经历过类似的事情吗? 谢谢

更新:

这些是主要的依赖关系:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.10.RELEASE</version>
</parent>

<spring-cloud-gcp.version>1.2.6.RELEASE</spring-cloud-gcp.version>

<dependency>
     <groupId>org.springframework.cloud</groupId>
     <artifactId>spring-cloud-gcp-starter-pubsub</artifactId>
</dependency>

你在哪里消费这些信息?在您的本地环境中?是的,我有,但是我们在Kubernetes Engine中部署的版本也有相同的问题。您可以共享最小的可复制代码吗?刚刚根据您的设置添加了一个更新,我很惊讶这会发生。你对春天的使用看起来不错。只要您的代码没有抛出运行时异常,您的消息将在消息接收方法工作后得到确认。1) 您确定您的代码在运行每消息逻辑后正在发送Ack吗?2) 您如何始终如一地重新发送邮件?每次还是偶尔一次?
@Bean
public PubSubInboundChannelAdapter messageChannelAdapter(
        @Qualifier("pubsubInputChannel") MessageChannel inputChannel,
        PubSubTemplate pubSubTemplate) {
    LOGGER.info("pubsubInputChannel");
    PubSubInboundChannelAdapter adapter =
            new PubSubInboundChannelAdapter(pubSubTemplate, subscription);
    adapter.setOutputChannel(inputChannel);
    adapter.setAckMode(AckMode.AUTO_ACK);
    return adapter;
}

@Bean
public MessageChannel pubsubInputChannel() {
    return new DirectChannel();
}

@Bean
@ServiceActivator(inputChannel = "pubsubInputChannel")
public MessageHandler messageReceiver() {
    return message -> {
        String json = new String((byte[]) message.getPayload());
        LOGGER.info("Message arrived! Payload: " + json);
        //Main code here
        //Operations might take some minutes to be finished
    };
}