• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SQSConnectionFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: jmsConnectionFactory

import com.amazon.sqs.javamessaging.SQSConnectionFactory; //导入依赖的package包/类
/**
 * Gets a JMS connection factory.
 *
 * @return the JMS connection factory.
 */
@Bean
public ConnectionFactory jmsConnectionFactory()
{
    AwsParamsDto awsParamsDto = awsHelper.getAwsParamsDto();

    ClientConfiguration clientConfiguration = new ClientConfiguration();

    // Only set the proxy hostname and/or port if they're configured.
    if (StringUtils.isNotBlank(awsParamsDto.getHttpProxyHost()))
    {
        clientConfiguration.setProxyHost(awsParamsDto.getHttpProxyHost());
    }
    if (awsParamsDto.getHttpProxyPort() != null)
    {
        clientConfiguration.setProxyPort(awsParamsDto.getHttpProxyPort());
    }

    return SQSConnectionFactory.builder().withClientConfiguration(clientConfiguration).build();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:25,代码来源:ServiceSpringModuleConfig.java


示例2: 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


示例3: 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


示例4: sqsConnectionFactory

import com.amazon.sqs.javamessaging.SQSConnectionFactory; //导入依赖的package包/类
@Bean
public SQSConnectionFactory sqsConnectionFactory() throws JMSException {

    return new SQSConnectionFactory(
            new ProviderConfiguration(),
            AmazonSQSClientBuilder.standard()
                    .withRegion(Regions.AP_SOUTHEAST_2)
                    .withCredentials(new ProfileCredentialsProvider(CREDENTIALS_PROVIDER))
    );
}
 
开发者ID:hafidsousa,项目名称:webcrawler,代码行数:11,代码来源:AppConfig.java


示例5: createConnection

import com.amazon.sqs.javamessaging.SQSConnectionFactory; //导入依赖的package包/类
@Override
public Connection createConnection() throws JMSException {
	Builder builder = SQSConnectionFactory.builder().withAWSCredentialsProvider(new StaticCredentialsProvider(new BasicAWSCredentials(this.accessKey,this.secretKey)));
	
	if (this.regionName != null && ! this.regionName.isEmpty()) {
		builder = builder.withRegionName(regionName);
	}
	
	this.factory = builder.build();
	
	return factory.createConnection();
}
 
开发者ID:TremoloSecurity,项目名称:OpenUnison,代码行数:13,代码来源:AwsSqsConnectionFactory.java


示例6: 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


示例7: starting

import com.amazon.sqs.javamessaging.SQSConnectionFactory; //导入依赖的package包/类
@Override
protected void starting(Description description)
{
  final String methodName = description.getMethodName();
  final String className = description.getClassName();

  testBase = new SQSTestBase();
  if (testBase.validateTestCreds() == false) {
    return;
  }
  testBase.generateCurrentQueueName(methodName);
  try {
    testBase.beforTest();
  } catch (AssumptionViolatedException ave) {
    throw ave;
  } catch (Exception e) {
    throw new RuntimeException(e);
  }

  baseDir = "target/" + className + "/" + methodName;

  Attribute.AttributeMap attributeMap = new Attribute.AttributeMap.DefaultAttributeMap();
  attributeMap.put(Context.OperatorContext.SPIN_MILLIS, 500);
  attributeMap.put(Context.DAGContext.APPLICATION_PATH, baseDir);

  context = mockOperatorContext(1, attributeMap);
  operator = new JMSStringInputOperator();
  operator.setConnectionFactoryBuilder(new JMSBase.ConnectionFactoryBuilder()
  {

    @Override
    public ConnectionFactory buildConnectionFactory()
    {
      // Create the connection factory using the environment variable credential provider.
      // Connections this factory creates can talk to the queues in us-east-1 region.
      SQSConnectionFactory connectionFactory =
          SQSConnectionFactory.builder()
          .withRegion(Region.getRegion(Regions.US_EAST_1))
          .withAWSCredentialsProvider(new PropertiesFileCredentialsProvider(testBase.getDevCredsFilePath()))
          .build();
      return connectionFactory;
    }

    @Override
    public String toString()
    {
      return className + "/" + methodName + "/ConnectionFactoryBuilder";
    }

  });
  operator.setSubject(testBase.getCurrentQueueName());
  // for SQS ack mode should be "AUTO_ACKNOWLEDGE" and transacted = false
  operator.setAckMode("AUTO_ACKNOWLEDGE");
  operator.setTransacted(false);

  sink = new CollectorTestSink<>();
  operator.output.setSink(sink);
  operator.setup(context);
  operator.activate(context);
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:61,代码来源:SQSStringInputOperatorTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultDocument类代码示例发布时间:2022-05-22
下一篇:
Java FSImageFormatPBINode类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap