小编sou*_*ikc的帖子

AWS应用程序的Spring启动启动错误:没有可用的EC2元数据

当我尝试在本地运行Spring boot-AWS应用程序时,我收到以下错误:

没有可用的EC2元数据,因为应用程序未在EC2环境中运行.仅当应用程序在EC2实例上运行时,才能进行区域检测

我的aws-config.xml如下所示:

  <aws-context:context-credentials>
     <aws-context:simple-credentials access-key="*****" secret-key="*****"/>
  </aws-context:context-credentials>  
    <aws-context:context-region auto-detect="false" region="ap-south-1" />  
 <aws-context:context-resource-loader/>  
 <aws-messaging:annotation-driven-queue-listener max-number-of-messages="10" wait-time-out="20" visibility-timeout="3600"/> 
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用以下类中的SQSListner进行监听:

 @Configuration
 @EnableSqs
 @ImportResource("classpath:/aws-config.xml")
 @EnableRdsInstance(databaseName = "******", 
               dbInstanceIdentifier = "*****", 
               password = "******")
 public class AwsResourceConfig {
@SqsListener(value = "souviksqs", deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS)
public void receiveNewFileUpload(S3EventNotification event) {
    try {
        if ( event != null && !CollectionUtils.isNullOrEmpty( event.getRecords() ) && event.getRecords().get( 0 ) != null ) {
            S3Entity entry = event.getRecords().get(0).getS3();
            System.out.println("############ File Uploaded to ###################### " + entry.getBucket().getName() + "/" + …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services spring-boot aws-sdk

18
推荐指数
4
解决办法
8079
查看次数

Spring Cloud AWS SQS监听器不工作

每当在 Amazon S3 中上传文件时,我都会尝试为 AWS SQS 配置监听器。我已经配置了 S3 中的事件,以便在 S3 中上传文件时将消息转储到 SQS 中。

现在我正在使用 Spring cloud(版本 - 1.2.1.RELEASE)为 S3 事件配置 SQS Listner。以下是我的配置文件:

aws-config.xml

<aws-context:context-credentials>
<aws-context:simple-credentials access-key="*******" secret-key="******"/>
</aws-context:context-credentials>
<aws-context:context-region  region="ap-south-1" />  
<aws-context:context-resource-loader/>  
<aws-messaging:annotation-driven-queue-listener max-number-of-messages="10" 
wait-time-out="20" visibility-timeout="3600""/> 
Run Code Online (Sandbox Code Playgroud)

AWSResourceConfig.java

@Configuration
 @EnableSqs
 @ImportResource("classpath:/aws-config.xml")
 @EnableRdsInstance(databaseName = "******", 
               dbInstanceIdentifier = "*****", 
               password = "******")
 public class AwsResourceConfig {
@SqsListener(value = "souviksqs", deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS)
public void receiveNewFileUpload(S3EventNotification event) {
    try {
        if ( event != null && !CollectionUtils.isNullOrEmpty( event.getRecords() ) && event.getRecords().get( 0 ) != …
Run Code Online (Sandbox Code Playgroud)

java spring amazon-s3 amazon-web-services spring-boot

4
推荐指数
1
解决办法
6328
查看次数

SQL查询以查找具有相同电子邮件域的最大计数

我有一个电子邮件ID列,用于存储完整的电子邮件ID.我希望得到基于域的最大数量,即@ gmail.com,@ xyz.com似乎在GROUP BY子句中我们不能应用任何通配符,只考虑完整电子邮件地址中的域.

mysql sql

0
推荐指数
1
解决办法
247
查看次数