org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter Java Examples
The following examples show how to use
org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractJMSProcessor.java From localization_nifi with Apache License 2.0 | 6 votes |
/** * This method essentially performs initialization of this Processor by * obtaining an instance of the {@link ConnectionFactory} from the * {@link JMSConnectionFactoryProvider} (ControllerService) and performing a * series of {@link ConnectionFactory} adaptations which eventually results * in an instance of the {@link CachingConnectionFactory} used to construct * {@link JmsTemplate} used by this Processor. */ private void buildTargetResource(ProcessContext context) { if (this.targetResource == null) { JMSConnectionFactoryProviderDefinition cfProvider = context.getProperty(CF_SERVICE).asControllerService(JMSConnectionFactoryProviderDefinition.class); ConnectionFactory connectionFactory = cfProvider.getConnectionFactory(); UserCredentialsConnectionFactoryAdapter cfCredentialsAdapter = new UserCredentialsConnectionFactoryAdapter(); cfCredentialsAdapter.setTargetConnectionFactory(connectionFactory); cfCredentialsAdapter.setUsername(context.getProperty(USER).getValue()); cfCredentialsAdapter.setPassword(context.getProperty(PASSWORD).getValue()); this.cachingConnectionFactory = new CachingConnectionFactory(cfCredentialsAdapter); this.cachingConnectionFactory.setSessionCacheSize(Integer.parseInt(context.getProperty(SESSION_CACHE_SIZE).getValue())); JmsTemplate jmsTemplate = new JmsTemplate(); jmsTemplate.setConnectionFactory(this.cachingConnectionFactory); jmsTemplate.setPubSubDomain(TOPIC.equals(context.getProperty(DESTINATION_TYPE).getValue())); // set of properties that may be good candidates for exposure via configuration jmsTemplate.setReceiveTimeout(1000); this.targetResource = this.finishBuildingTargetResource(jmsTemplate, context); } }
Example #2
Source File: AbstractJMSProcessor.java From solace-integration-guides with Apache License 2.0 | 6 votes |
/** * This method essentially performs initialization of this Processor by * obtaining an instance of the {@link ConnectionFactory} from the * {@link JMSConnectionFactoryProvider} (ControllerService) and performing a * series of {@link ConnectionFactory} adaptations which eventually results * in an instance of the {@link CachingConnectionFactory} used to construct * {@link JmsTemplate} used by this Processor. */ private void buildTargetResource(ProcessContext context) { if (this.targetResource == null) { JMSConnectionFactoryProviderDefinition cfProvider = context.getProperty(CF_SERVICE).asControllerService(JMSConnectionFactoryProviderDefinition.class); ConnectionFactory connectionFactory = cfProvider.getConnectionFactory(); UserCredentialsConnectionFactoryAdapter cfCredentialsAdapter = new UserCredentialsConnectionFactoryAdapter(); cfCredentialsAdapter.setTargetConnectionFactory(connectionFactory); cfCredentialsAdapter.setUsername(context.getProperty(USER).getValue()); cfCredentialsAdapter.setPassword(context.getProperty(PASSWORD).getValue()); this.cachingConnectionFactory = new CachingConnectionFactory(cfCredentialsAdapter); this.cachingConnectionFactory.setSessionCacheSize(Integer.parseInt(context.getProperty(SESSION_CACHE_SIZE).getValue())); JmsTemplate jmsTemplate = new JmsTemplate(); jmsTemplate.setConnectionFactory(this.cachingConnectionFactory); jmsTemplate.setPubSubDomain(TOPIC.equals(context.getProperty(DESTINATION_TYPE).getValue())); // set of properties that may be good candidates for exposure via configuration jmsTemplate.setReceiveTimeout(1000); this.targetResource = this.finishBuildingTargetResource(jmsTemplate, context); } }
Example #3
Source File: AbstractJMSProcessor.java From nifi with Apache License 2.0 | 6 votes |
/** * This method essentially performs initialization of this Processor by * obtaining an instance of the {@link ConnectionFactory} from the * {@link JMSConnectionFactoryProvider} (ControllerService) and performing a * series of {@link ConnectionFactory} adaptations which eventually results * in an instance of the {@link CachingConnectionFactory} used to construct * {@link JmsTemplate} used by this Processor. */ private T buildTargetResource(ProcessContext context) { final ConnectionFactory connectionFactory = connectionFactoryProvider.getConnectionFactory(); final UserCredentialsConnectionFactoryAdapter cfCredentialsAdapter = new UserCredentialsConnectionFactoryAdapter(); cfCredentialsAdapter.setTargetConnectionFactory(connectionFactory); cfCredentialsAdapter.setUsername(context.getProperty(USER).evaluateAttributeExpressions().getValue()); cfCredentialsAdapter.setPassword(context.getProperty(PASSWORD).getValue()); final CachingConnectionFactory cachingFactory = new CachingConnectionFactory(cfCredentialsAdapter); setClientId(context, cachingFactory); JmsTemplate jmsTemplate = new JmsTemplate(); jmsTemplate.setConnectionFactory(cachingFactory); jmsTemplate.setPubSubDomain(TOPIC.equals(context.getProperty(DESTINATION_TYPE).getValue())); return finishBuildingJmsWorker(cachingFactory, jmsTemplate, context); }