Search in sources :

Example 6 with SqsService

use of com.formkiq.aws.sqs.SqsService in project formkiq-core by formkiq.

the class AbstractRequestHandler method before.

/**
 * before.
 *
 * @throws Exception Exception
 */
@BeforeEach
public void before() throws Exception {
    // this.dbhelper = new DynamoDbHelper(TestServices.getDynamoDbConnection(DYNAMODB_PORT));
    // this.dbhelper.truncateDocumentsTable();
    // this.dbhelper.truncateWebhooks();
    // this.dbhelper.truncateConfig();
    this.map.put("APP_ENVIRONMENT", TestServices.FORMKIQ_APP_ENVIRONMENT);
    this.map.put("DOCUMENTS_TABLE", documentsTable);
    this.map.put("CACHE_TABLE", cacheTable);
    this.map.put("DOCUMENTS_S3_BUCKET", BUCKET_NAME);
    this.map.put("STAGE_DOCUMENTS_S3_BUCKET", STAGE_BUCKET_NAME);
    this.map.put("AWS_REGION", AWS_REGION.toString());
    this.map.put("DEBUG", "true");
    this.map.put("SQS_DOCUMENT_FORMATS", TestServices.getSqsDocumentFormatsQueueUrl());
    this.map.put("DISTRIBUTION_BUCKET", "formkiq-distribution-us-east-pro");
    this.map.put("FORMKIQ_TYPE", "core");
    this.map.put("WEBSOCKET_SQS_URL", TestServices.getSqsWebsocketQueueUrl());
    createApiRequestHandler(this.map);
    this.awsServices = new CoreRequestHandler().getAwsServices();
    SqsService sqsservice = this.awsServices.sqsService();
    for (String queue : Arrays.asList(TestServices.getSqsDocumentFormatsQueueUrl())) {
        ReceiveMessageResponse response = sqsservice.receiveMessages(queue);
        while (response.messages().size() > 0) {
            for (Message msg : response.messages()) {
                sqsservice.deleteMessage(queue, msg.receiptHandle());
            }
            response = sqsservice.receiveMessages(queue);
        }
    }
}
Also used : Message(software.amazon.awssdk.services.sqs.model.Message) SqsService(com.formkiq.aws.sqs.SqsService) ReceiveMessageResponse(software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

SqsService (com.formkiq.aws.sqs.SqsService)6 SqsConnectionBuilder (com.formkiq.aws.sqs.SqsConnectionBuilder)5 S3ConnectionBuilder (com.formkiq.aws.s3.S3ConnectionBuilder)4 S3Service (com.formkiq.aws.s3.S3Service)4 SnsConnectionBuilder (com.formkiq.aws.sns.SnsConnectionBuilder)4 SnsService (com.formkiq.aws.sns.SnsService)4 Region (software.amazon.awssdk.regions.Region)4 SsmConnectionBuilder (com.formkiq.aws.ssm.SsmConnectionBuilder)3 SsmServiceImpl (com.formkiq.aws.ssm.SsmServiceImpl)3 DocumentServiceImpl (com.formkiq.stacks.dynamodb.DocumentServiceImpl)3 BeforeClass (org.junit.BeforeClass)3 SsmService (com.formkiq.aws.ssm.SsmService)2 DynamoDbConnectionBuilder (com.formkiq.stacks.dynamodb.DynamoDbConnectionBuilder)2 BeforeAll (org.junit.jupiter.api.BeforeAll)2 AwsCredentialsProvider (software.amazon.awssdk.auth.credentials.AwsCredentialsProvider)2 S3Client (software.amazon.awssdk.services.s3.S3Client)2 CognitoConnectionBuilder (com.formkiq.aws.cognito.CognitoConnectionBuilder)1 CognitoService (com.formkiq.aws.cognito.CognitoService)1 FormKiqClientConnection (com.formkiq.stacks.client.FormKiqClientConnection)1 FormKiqClientV1 (com.formkiq.stacks.client.FormKiqClientV1)1