当前位置: 首页>>代码示例>>Java>>正文


Java SQSConnectionFactory.createConnection方法代码示例

本文整理汇总了Java中com.amazon.sqs.javamessaging.SQSConnectionFactory.createConnection方法的典型用法代码示例。如果您正苦于以下问题:Java SQSConnectionFactory.createConnection方法的具体用法?Java SQSConnectionFactory.createConnection怎么用?Java SQSConnectionFactory.createConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazon.sqs.javamessaging.SQSConnectionFactory的用法示例。


在下文中一共展示了SQSConnectionFactory.createConnection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sqsConnection

import com.amazon.sqs.javamessaging.SQSConnectionFactory; //导入方法依赖的package包/类
@Bean
public SQSConnection sqsConnection(final AWSCredentialsProvider awsCredentialsProvider,
    final ClientConfiguration awsClientConfig, final Region awsRegion) throws JMSException {
    
    SQSConnectionFactory connectionFactory = SQSConnectionFactory.builder()
        .withRegion(awsRegion) //Gets region form meta data
        .withAWSCredentialsProvider(awsCredentialsProvider)
        .withClientConfiguration(awsClientConfig)
        .build();

    return connectionFactory.createConnection();
}
 
开发者ID:shinesolutions,项目名称:aem-orchestrator,代码行数:13,代码来源:AwsConfig.java

示例2: sqsConnection

import com.amazon.sqs.javamessaging.SQSConnectionFactory; //导入方法依赖的package包/类
@Bean
public SQSConnection sqsConnection(AWSCredentialsProvider awsCredentialsProvider,
                                   ClientConfiguration awsClientConfig) throws JMSException {

    SQSConnectionFactory connectionFactory = SQSConnectionFactory.builder()
            .withRegion(RegionUtils.getRegion(awsRegion))
            .withAWSCredentialsProvider(awsCredentialsProvider)
            .withClientConfiguration(awsClientConfig)
            .build();

    return connectionFactory.createConnection();
}
 
开发者ID:shinesolutions,项目名称:aem-stack-manager,代码行数:13,代码来源:AwsConfig.java

示例3: init

import com.amazon.sqs.javamessaging.SQSConnectionFactory; //导入方法依赖的package包/类
public void init(AWSKafkaConfig config){
	
	this.config = config;
	deDuplicationId  = config.getDeDeupPrefix();
	
	mXmitDisable = config.getAwsXmitDisable();
	
	SQSConnectionFactory connectionFactory = new SQSConnectionFactory(
	        new ProviderConfiguration(),
	        AmazonSQSClientBuilder.standard()
	                .withRegion(config.getRegions())
	                .withCredentials(config.getCredentialsProvider())
	        );
	try{ 
		
		mPreProcessor = config.getPre();
		mXmitReplacement = config.getReplaceXmit(this);
		// Create the connection.
		connection = connectionFactory.createConnection();
		
		// Create the queue if needed
        //ExampleCommon.ensureQueueExists(connection, config.getQueueName());
            
        // Create the session
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        producer = session.createProducer( session.createQueue( config.getQueueName() ) );
        
     // Get the wrapped client
        AmazonSQSMessagingClientWrapper client = connection.getWrappedAmazonSQSClient();

        // Create an Amazon SQS queue if it does not already exist
        if (!client.queueExists(config.getQueueName())) {
            Map<String, String> attributes = new HashMap<String, String>();
            attributes.put(config.getQueueName(), "true");
            attributes.put("ContentBasedDeduplication", "true");
            client.createQueue(new CreateQueueRequest().withQueueName(config.getQueueName()).withAttributes(attributes));
        }
	}catch(JMSException e){
	}
       
}
 
开发者ID:datamachines,项目名称:KafkaToSQS,代码行数:42,代码来源:SQSProducer.java


注:本文中的com.amazon.sqs.javamessaging.SQSConnectionFactory.createConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。