我正在使用基本示例在 Ubuntu 上构建 lambda。它构建时没有任何错误,但如果我在 aws 上上传并测试它,则会崩溃:
{
"errorMessage": "RequestId: 7f4d0aca-125c-4032-98dd-9ff387e5252b Error: Runtime exited with error: exit status 1",
"errorType": "Runtime.ExitError"
}
Run Code Online (Sandbox Code Playgroud)
日志输出为:
START
RequestId: 7f4d0aca-125c-4032-98dd-9ff387e5252b
Version: $LATEST.~.jwtauthorizeraws.jwtauthorizerawsapplication: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by ./~.jwtauthorizerawsapplication)
END
RequestId: 7f4d0aca-125c-4032-98dd-9ff387e5252b
REPORT
RequestId: 7f4d0aca-125c-4032-98dd-9ff387e5252b
Duration: 56.02 ms
Billed Duration: 57 ms
Memory Size: 128 MB
Max Memory Used: 7 MB
RequestId: 7f4d0aca-125c-4032-98dd-9ff387e5252b
Error: Runtime exited with error: exit status 1
Runtime.ExitError
Run Code Online (Sandbox Code Playgroud) 我有一个服务,它从不同的消息队列接收不同的结构化消息。我们可以针对@StreamListener conditions每种消息类型选择如何处理该消息。举个例子:
我们收到两种不同类型的消息,它们具有不同的标头字段和值,例如
\n\n来自“订单”队列的传入:
\n\nOrder1: { Header: {catalog:groceries} }\nOrder2: { Header: {catalog:tools} }\nRun Code Online (Sandbox Code Playgroud)\n\n来自“发货”队列的传入:
\n\nShipment1: { Header: {region:Europe} }\nShipment2: { Header: {region:America} }\nRun Code Online (Sandbox Code Playgroud)\n\n每个队列都有一个绑定,根据该绑定,@StreamListener我可以按目录和区域以不同的方式处理消息
例如
\n\n@StreamListener(target = OrderSink.ORDER_CHANNEL, condition = "headers[\'catalog\'] == \'groceries\'")\npublic void onGroceriesOrder(GroceryOder order){\n...\n}\nRun Code Online (Sandbox Code Playgroud)\n\n那么问题是,如何使用新的 Spring Cloud Function 方法来实现这一点?
\n\n\n\nAlso, for SpEL, the root object of the evaluation context is Message so you can do evaluation on individual headers …
我正在开发一个分布式应用程序项目,其中需要根据在 api 网关上使用服务的客户端进行速率限制和身份验证。我想知道设计网关的最佳解决方案。
我应该使用 Spring Cloud gateway 还是 Spring Cloud function/AWS Lambda 来创建网关服务?
microservices aws-lambda aws-api-gateway spring-cloud-gateway spring-cloud-function
我用 Spring Cloud Function 创建了一个 AWS lamnda,但我认为这种方法在执行 lambda 时很慢。
我的 lambda 非常简单,它只将一个对象保存到数据库中。
对另一种语言或框架使用 Spring Boot 函数是个好主意吗?
例如使用 phyton、nodejs 或其他解决方案。
是否可以使用spring.cloud.function具有多个独立函数/绑定的函数式( ) 样式的反应式 SCS 应用程序?我发现的所有示例总是只注册一个具有默认绑定的功能性 bean input, output。我想注册多个,每个都有自己的绑定。
传统上可以使用spring-cloud-stream-reactive它来完成,但现在不赞成使用功能支持。
嘿,我按照分步指南在 Spring Boot 中设置 kafka。
但现在我无法启动该应用程序。有什么建议 :)
日志中的错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'functionInitializer' defined in class path resource [org/springframework/cloud/stream/function/FunctionConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Found more then one function in BeanFactory: [persistentEntities, resourceMappings]. Consider providing 'spring.cloud.function.definition' property.
Run Code Online (Sandbox Code Playgroud)
什么是 spring.cloud.function.definition?以及如何设置呢?引起原因:java.lang.IllegalArgumentException:在 BeanFactory 中发现多个函数:[persistentEntities,resourceMappings]。考虑提供“spring.cloud.function.definition”属性。
java spring-boot spring-cloud spring-cloud-stream spring-cloud-function
我有简单的@Bean(Java 8 函数),它们映射到目的地topic(-out和-in)。
@Bean
public Function<String, String> transform() {
return payload -> payload.toUpperCase();
}
@Bean
public Consumer<String> receive() {
return payload -> logger.info("Data received: " + payload);
}
Run Code Online (Sandbox Code Playgroud)
.yml配置:
spring:
cloud:
stream:
function:
definition: transform;receive
bindings:
transform-out-0:
destination: myTopic
receive-in-0:
destination: myTopic
Run Code Online (Sandbox Code Playgroud)
现在,我想transform通过调用来调用该函数REST,以便它的输出转到destination topic(即transform-out-0映射到)并由该目的地(映射到)myTopic拾取。基本上,每个 REST 调用都应该生成一个新的KAFKA实例并关闭它。consumerreceive-in-0myTopic Producer
我怎样才能做到这一点,请使用spring-cloud-stream?
谢谢
安舒曼
我有一个基于 Spring Boot 的库(使用 spring-data-mongo)来创建一个PersistentEntitiesbean。PersistentEntities碰巧实现了该Supplier<T>接口,因此 Spring Cloud Stream 功能绑定器正在创建与其的绑定。更具体地说,BeanFactoryAwareFunctionRegistry.discoverDefaultDefinitionIfNecessary发现它是类型为 的 bean Supplier。
我们使用 Spring Cloud Streams Kafka 绑定器,因此 Spring 尝试将每个对象发布到它创建的 Kafka 主题。这会导致 JSON 序列化程序中出现无限递归问题:
2019-12-04 15:36:54.323错误1 --- [调度-1] osihLoggingHandler:org.springframework.messaging.MessagingException:无法调用方法;嵌套异常是 org.springframework.messaging.converter.MessageConversionException:无法编写 JSON:无限递归(StackOverflowError)(通过引用链:org.springframework.data.mongodb.core.mapping.BasicMongoPersistentEntity["idProperty"] -> org. springframework.data.mongodb.core.mapping.CachingMongoPersistentProperty["owner"] -> org.springframework.data.mongodb.core.mapping.BasicMongoPersistentEntity["idProperty"] -> org.springframework.data.mongodb.core.mapping。 CachingMongoPersistentProperty["owner"] -> org.springframework.data.mongodb.core.mapping.BasicMongoPersistentEntity["idProperty"] -> org.springframework.data.mongodb.core.mapping.CachingMongoPercientProperty["owner"] -> org. springframework.data.mongodb.core.mapping.BasicMongoPersistentEntity["idProperty"] -> org.springframework.data.mongodb.core.mapping.CachingMongoPersistentProperty["owner"] -> org.springframework.data.mongodb.core.mapping。 BasicMongoPersistentEntity["idProperty"] -> org.springframework.data.mongodb.core.mapping.CachingMongoPersistentProperty["owner"] -> org.springframework.data.mongodb.core.mapping.BasicMongoPersistentEntity["idProperty"] -> org.springframework.data.mongodb.core.mapping springframework.data.mongodb.core.mapping.CachingMongoPersistentProperty[“所有者”] ...
有没有办法将我的 bean 从函数绑定中排除?使用这个库的项目没有使用 Spring Cloud Function,但我更愿意保留这种可能性。
作为参考,我的 bean 定义为:
@Bean
public PersistentEntities …Run Code Online (Sandbox Code Playgroud)