问题标签 [spring-cloud-function]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
259 浏览

spring-boot - 运行graals原生spring cloud函数示例

我正在尝试在 spring-graals 中运行 aws 函数示例,“java”版本工作正常,但是当我测试“native”版本时,我在控制台中看到以下错误。

该示例将步骤记录到 output.txt 中,我在其中看到以下几行。

版本是spring-graals-native0.70.BUILD-SNAPSHOT.jar

版本是spring-cloud-function3.1.0-SNAPSHOT

pom 文件可以在这里找到

此外,在 aws 控制台中,我只能使用类型的处理程序进行测试,FunctionInvoker而不能使用SpringBootApiGatewayRequestHandler.

0 投票
1 回答
691 浏览

spring-cloud - Spring Cloud Stream 禁用重试

我正在使用具有响应式方法的 Spring Cloud 功能的 Spring Cloud Stream。我的活页夹是 RabbitMQ。根据定义 maxAttempts 属性是可以处理消息的次数(这就是我的解释)来自:https ://cloud.spring.io/spring-cloud-static/spring-cloud-stream/3.0.6.RELEASE /reference/html/spring-cloud-stream.html#_consumer_properties

maxAttempts:如果处理失败,尝试处理消息的次数(包括第一次)。设置为 1 以禁用重试。默认值:3。

问题是我的应用程序使用这个(默认)配置总是处理消息 4 次。现在我想禁用重试,所以我设置 max-attempts=1 并且消息总是被处理 2 次。我已经尝试设置spring.cloud.stream.rabbit.bindings.input.consumer.requeue-rejected=false虽然是默认设置。

关于如何让我的消息只处理一次的任何线索?

谢谢。

0 投票
2 回答
920 浏览

java - @Value 和 @Autowired 在 Azure Functions 中不起作用

我正在 Azure Functions 中编写 @TimerTrigger 函数。为此,我使用了 Spring Cloud Function for Azure。问题是每次访问服务或 JPARepository 时都会出现空指针异常。@Value("${VARIABLE}") 也给出了 null 但 System.getenv("VARIABLE") 确实提供了值。

代码 Main.Java 是:

函数 HelloHandler.java 文件是:

服务 MyService.Java 是:

我正在使用以下依赖项:

它给出了例外:

我不明白为什么它不能按预期使用所有 Spring 功能。

0 投票
1 回答
220 浏览

java - spring-cloud-function / spring-cloud-stream 中的函数组合是按值传递,还是重用它们之间的集成

嗨,不明白,“ spring-cloud-function”或“ spring-cloud-stream”的文档中都没有描述。如果我有两个函数“ Uppercase”和“ reverse”。假设我有一个源队列-“ uppercase-source”输入到“ Uppercase”函数,它确实输出到“ uppercase-output”。然后“大写输出”是“”函数的源,reverse该函数输出到“ reverse-output”。

如果我按以下方式执行功能组合:

生成的函数会使用“大写”和“反转”之间的值传递,还是生成的函数仍会使用介于这之间的队列/主题会说“大写输出”?

0 投票
1 回答
55 浏览

spring-boot - 如何通过 Azure Functions/Spring Cloud Function 调用 Spring Integration SFTP

我们目前有 Spring Boot 应用程序,它们使用 Spring Integration SFTP 基于 Cron 计划发送和接收文件。我们正在尝试使用 Spring Cloud Function 将应用程序转换为 Azure Function。只是想知道当应用程序收到来自 Azure Function 的 http 调用时,是否有任何方法可以调用 Spring Integration SFTP 适配器运行一次?从 Spring Integration 的文档来看,轮询器的唯一选择似乎是 Cron 或固定速率/固定延迟。提前感谢您的任何帮助或建议!

0 投票
1 回答
66 浏览

spring-cloud-stream - 如何在 SCS 应用程序中测试接收到的对象有效负载?(java.io.StreamCorruptedException:无效的流标头:反序列化期间的 7B0D0A20)

我正在测试 Spring Cloud Stream 应用程序,我想验证接收到的有效负载对象,但它是作为字节数组接收的。

在断言之前,我尝试使用以下代码将接收到的有效负载反序列化到对象:

但在测试运行期间接收到的数据无法反序列化,但有以下异常:

通过对象实现 Serializable 并不能解决异常。

测试代码

我用于测试文档中的官方 Spring Cloud Stream 测试部分。

如何在 Spring Cloud Stream 应用程序中测试接收到的对象?

0 投票
4 回答
617 浏览

spring-cloud-stream - 专用绑定的 Spring Cloud Stream 路由表达式

我想要一个连接到特定队列/主题的绑定,并根据特定的标题条目路由到正确的函数。

我找不到这种情况的任何例子。我尝试了几种方法,但没有一种方法能成功。

例如,这不起作用:

每一个具体的例子都值得赞赏

0 投票
1 回答
339 浏览

java - 如何从多部分文件中提取正文和文件名?

我正在用 Java 编写 AWS lambda。此 lambda 充当APIGatewayProxyRequestEvent.

API 网关端点将文件作为正文中的 multipart/form-data 发送。

在尝试实现业务逻辑时,我首先将正文提取到一个字节数组中

但是当我将这些字节写入字符串以从中提取数据时,我得到以下信息:

如何从多部分文件的字节流中获取文件的唯一内容?

0 投票
1 回答
1222 浏览

spring - 功能 Bean 注册在 AWS Lambda 上不返回 FunctionCatalog 类型的 bean

我尝试使用https://spring.io/blog/2018/10/22/functional-bean-registrations-in-spring-cloud-function中提到的功能 bean 注册并将其部署到 AWS Lambda。传统方式工作得很好,请参阅https://github.com/mydeveloperplanet/MySpringCloudFunctionPlanet/tree/feature/aws-funtion-bean-definition中的代码

但是,当我将应用程序转换为函数 bean 样式时,会出现以下错误:

代码如下(可在 GitHub https://github.com/mydeveloperplanet/MySpringCloudFunctionPlanet/tree/master获得):

我在这里想念什么?

0 投票
1 回答
112 浏览

spring-boot - Spring Cloud Stream - 发送和接收同步

在我的 Spring Boot 休息控制器中,我使用 StreamBridge 向 rabbitMQ 服务器发送消息,例如

有没有办法做一个send and wait the response