

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

# Java 메시지 서비스를 다른 Amazon SQS 클라이언트와 함께 사용
<a name="sqs-jms-client-with-sqs-clients"></a>

 AWS SDK와 함께 Amazon SQS Java Message Service(JMS) 클라이언트를 사용하면 Amazon SQS 메시지 크기가 256KB로 제한됩니다. 그러나 Amazon SQS 클라이언트를 사용하여 JMS 공급자를 생성할 수 있습니다. 예를 들어, JMS 클라이언트와 함께 Java용 Amazon SQS 확장 클라이언트 라이브러리를 사용하여 Amazon S3의 메시지 페이로드(최대 2GB)에 대한 참조가 들어 있는 Amazon SQS 메시지를 전송할 수 있습니다. 자세한 내용은 [Java 및 Amazon S3를 사용하여 대규모 Amazon SQS 메시지 관리](sqs-s3-messages.md) 단원을 참조하십시오.

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

이 예제를 테스트하기 전에 [JMS 및 Amazon SQS 작업을 위한 사전 조건](prerequisites.md)에서 사전 조건을 참조하세요.

```
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();
```