Amazon SQS Java 메시지 서비스(JMS) 클라이언트를 다른 Amazon SQS 클라이언트와 함께 사용 - Amazon Simple Queue Service

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

Amazon SQS Java 메시지 서비스(JMS) 클라이언트를 다른 Amazon SQS 클라이언트와 함께 사용

Amazon SQS Java 메시지 서비스(JMS) 클라이언트를 AWS SDK와 함께 사용하면 Amazon SQS 메시지 크기가 256KB로 제한됩니다. 그러나 Amazon SQS 클라이언트를 사용하여 JMS 공급자를 생성할 수 있습니다. 예를 들어, JMS 클라이언트와 함께 Java용 Amazon SQS 확장 클라이언트 라이브러리를 사용하여 Amazon S3의 메시지 페이로드(최대 2GB)에 대한 참조가 들어 있는 Amazon SQS 메시지를 전송할 수 있습니다. 자세한 내용은 자바와 아마존 S3를 사용하여 대용량 Amazon SQS 메시지 관리 섹션을 참조하세요.

다음의 Java 코드 예제에서는 확장 클라이언트 라이브러리에 대한 JMS 공급자를 생성합니다.

AmazonS3 s3 = new AmazonS3Client(credentials); Region s3Region = Region.getRegion(Regions.US_WEST_2); s3.setRegion(s3Region); // Set the Amazon S3 bucket name, and set a lifecycle rule on the bucket to // permanently delete objects a certain number of days after each object's creation date. // Next, create the bucket, and enable message objects to be stored in the bucket. BucketLifecycleConfiguration.Rule expirationRule = new BucketLifecycleConfiguration.Rule(); expirationRule.withExpirationInDays(14).withStatus("Enabled"); BucketLifecycleConfiguration lifecycleConfig = new BucketLifecycleConfiguration().withRules(expirationRule); s3.createBucket(s3BucketName); s3.setBucketLifecycleConfiguration(s3BucketName, lifecycleConfig); System.out.println("Bucket created and configured."); // Set the SQS extended client configuration with large payload support enabled. ExtendedClientConfiguration extendedClientConfig = new ExtendedClientConfiguration() .withLargePayloadSupportEnabled(s3, s3BucketName); AmazonSQS sqsExtended = new AmazonSQSExtendedClient(new AmazonSQSClient(credentials), extendedClientConfig); Region sqsRegion = Region.getRegion(Regions.US_WEST_2); sqsExtended.setRegion(sqsRegion);

다음의 Java 코드 예제에서는 연결 팩토리를 생성합니다.

// Create the connection factory using the environment variable credential provider. // Pass the configured Amazon SQS Extended Client to the JMS connection factory. SQSConnectionFactory connectionFactory = new SQSConnectionFactory( new ProviderConfiguration(), sqsExtended ); // Create the connection. SQSConnection connection = connectionFactory.createConnection();