I am trying to write my first little quarkus camel AWSSQS consumer and I just can't find any (simple or otherwise) examples to start off with.
I have generated a skeleton app via the quarkus.io webpage and I've created a route to just consume the JSON off of my SQS queue (the queue is created and populated with messages and I can consume them with "raw" java).
It is a fifo queue containing JSON test messages.
My routebuilder class is as follows:
package sun.java.tester.quarkus.camel.sqs;
import org.apache.camel.builder.RouteBuilder;
/**
*
* @author ELMARM
*/
public class MyRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
public void configure() throws Exception {
from("aws2-sqs://JSONTestQ.fifo?accessKey=AKIAYAKVQFZGTCDOR3OP&secretKey=yyyyy®ion=us-east-2")
.log("We have a message! ${body}")
.to("file:target/output?fileName=tester-message-${date:now:MMDDyy-HHmmss}.json");
}
When I start the quarkus application I get the following error:
2021-08-23 15:04:06,630 ERROR [org.apa.cam.qua.mai.CamelMainRuntime] (Quarkus Main Thread) Failed to start application: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[From[aws2-sqs://JSONTestQ.fifo?accessKey=AKIAY... because of Failed to resolve endpoint: aws2-sqs://JSONTestQ.fifo?accessKey=AKIAYAKVQFZGTCDOR3OP®ion=us-east-2&secretKey=xxxxxx due to: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
The Canonical String for this request should have been 'POST /
amz-sdk-invocation-id:9f2e22b6-3d08-2dc2-e45e-643e84ba6437 amz-sdk-request:attempt=1; max=3 content-length:36 content-type:application/x-www-form-urlencoded; charset=utf-8 host:sqs.us-east-2.amazonaws.com x-amz-date:20210823T130405Z
amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-date 48a38266faf90970d6c7fea9b15e6ba366e5f6397c2970fc893f8a7b5e207bd0'
The String-to-Sign should have been 'AWS4-HMAC-SHA256 20210823T130405Z 20210823/us-east-2/sqs/aws4_request 07d49a70f6163cd5d0bbb21d1b3e2a8c1927feb3ec4ddbd7fcbc768f3e994189' (Service: Sqs, Status Code: 403, Request ID: fe69821c-e9be-5250-b428-db8176b8c0c2, Extended Request ID: null) at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:80) at org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49) at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:826) at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:716) at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2756) at org.apache.camel.quarkus.core.FastCamelContext.doInit(FastCamelContext.java:158) at org.apache.camel.support.service.BaseService.init(BaseService.java:83) at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2475) at org.apache.camel.support.service.BaseService.start(BaseService.java:111) at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2494) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:245) at org.apache.camel.quarkus.main.CamelMain.doStart(CamelMain.java:94) at org.apache.camel.support.service.BaseService.start(BaseService.java:119) at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:139) at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49) at org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:45) at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy_0(CamelBootstrapProcessor$boot-173480958.zig:101) at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy(CamelBootstrapProcessor$boot-173480958.zig:40) at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:898) at io.quarkus.runtime.Application.start(Application.java:101) at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:101) at io.quarkus.runtime.Quarkus.run(Quarkus.java:66) at io.quarkus.runtime.Quarkus.run(Quarkus.java:42) at io.quarkus.runtime.Quarkus.run(Quarkus.java:119) at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:98) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: aws2-sqs://JSONTestQ.fifo?accessKey=AKIAYAKVQFZGTCDOR3OP®ion=us-east-2&secretKey=xxxxxx due to: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
I've checked and my accessKey and secretKey are correct as my "raw" java program can consume the messages.
I'm VERY green with quarkus (and even more so with camel), so any direction would be greatly appreciated.
Regards
Elmar
2条答案
按热度按时间snz8szmq1#
“from”终结点URI方案应为
aws2-sqs
。例如:请参见文档中的URI格式部分:
https://camel.apache.org/components/3.11.x/aws2-sqs-component.html。
ergxz8rk2#
好吧,经过很多的考验和磨难,原来密钥中有“特殊”字符(iidoEe. a +),为此你必须在你的密钥参数周围放一个RAW。
因此,我的路线现在看起来如下:
这就完成了任务。我现在接收我的消息并将它们存储在一个.json文件中。