本文整理汇总了Java中org.springframework.jms.support.destination.DestinationResolver类的典型用法代码示例。如果您正苦于以下问题:Java DestinationResolver类的具体用法?Java DestinationResolver怎么用?Java DestinationResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DestinationResolver类属于org.springframework.jms.support.destination包,在下文中一共展示了DestinationResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: webSphereResourceAdapterSetup
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
@Test
public void webSphereResourceAdapterSetup() throws Exception {
Destination destination = new StubQueue();
DestinationResolver destinationResolver = mock(DestinationResolver.class);
given(destinationResolver.resolveDestinationName(null, "destinationname", false)).willReturn(destination);
DefaultJmsActivationSpecFactory activationSpecFactory = new DefaultJmsActivationSpecFactory();
activationSpecFactory.setDestinationResolver(destinationResolver);
StubWebSphereActivationSpecImpl spec = (StubWebSphereActivationSpecImpl) activationSpecFactory
.createActivationSpec(new StubWebSphereResourceAdapterImpl(), activationSpecConfig);
assertEquals(destination, spec.getDestination());
assertEquals(5, spec.getMaxConcurrency());
assertEquals(3, spec.getMaxBatchSize());
}
示例2: processAndReplyWithSendTo
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
private void processAndReplyWithSendTo(MessagingMessageListenerAdapter listener, boolean pubSubDomain) throws JMSException {
String body = "echo text";
String correlationId = "link-1234";
Destination replyDestination = new Destination() {};
DestinationResolver destinationResolver = mock(DestinationResolver.class);
TextMessage reply = mock(TextMessage.class);
QueueSender queueSender = mock(QueueSender.class);
Session session = mock(Session.class);
given(destinationResolver.resolveDestinationName(session, "replyDestination", pubSubDomain))
.willReturn(replyDestination);
given(session.createTextMessage(body)).willReturn(reply);
given(session.createProducer(replyDestination)).willReturn(queueSender);
listener.setDestinationResolver(destinationResolver);
StubTextMessage inputMessage = createSimpleJmsTextMessage(body);
inputMessage.setJMSCorrelationID(correlationId);
listener.onMessage(inputMessage, session);
verify(destinationResolver).resolveDestinationName(session, "replyDestination", pubSubDomain);
verify(reply).setJMSCorrelationID(correlationId);
verify(queueSender).send(reply);
verify(queueSender).close();
}
示例3: getConfiguration
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
public JmsConfiguration getConfiguration() {
if (configuration == null) {
configuration = createConfiguration();
// If we are being configured with spring...
if (applicationContext != null) {
Map<String, ConnectionFactory> beansOfTypeConnectionFactory = applicationContext.getBeansOfType(ConnectionFactory.class);
if (!beansOfTypeConnectionFactory.isEmpty()) {
ConnectionFactory cf = beansOfTypeConnectionFactory.values().iterator().next();
configuration.setConnectionFactory(cf);
}
Map<String, DestinationResolver> beansOfTypeDestinationResolver = applicationContext.getBeansOfType(DestinationResolver.class);
if (!beansOfTypeDestinationResolver.isEmpty()) {
DestinationResolver destinationResolver = beansOfTypeDestinationResolver.values().iterator().next();
configuration.setDestinationResolver(destinationResolver);
}
}
}
return configuration;
}
示例4: outputAsync
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
@Bean
public MessageChannel outputAsync(
@Qualifier("jmsConnectionFactory") ConnectionFactory connectionFactory,
DestinationResolver destinationResolver) {
DynamicJmsTemplate jmsTemplate = new DynamicJmsTemplate();
jmsTemplate.setConnectionFactory(connectionFactory);
jmsTemplate.setDestinationResolver(destinationResolver);
// TODO server should be detecting conversion type
jmsTemplate.setMessageConverter(new XmlEncoderDecoderConverter());
JmsSendingMessageHandler handler = new JmsSendingMessageHandler(jmsTemplate);
handler.setDestinationName("server.queue");
SubscribableChannel ch = new FixedSubscriberChannel(handler);
return ch;
}
示例5: myDestinationResolver
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
/**
* Uses properties to attempt to map a JMS destination name to an actual
* queue/topic name.
*
* @param environment
* @return
*/
@Bean
public DestinationResolver myDestinationResolver(final Environment environment) {
return new DestinationResolver() {
private DestinationResolver dynamicDestinationResolver = new DynamicDestinationResolver();
@Override
public Destination resolveDestinationName(Session session, String destinationName,
boolean pubSubDomain) throws JMSException {
String dname = environment.getProperty("jms.destination." + destinationName,
destinationName);
if (LOG.isDebugEnabled()) {
LOG.debug("Resolved destination '" + destinationName + "' to '" + dname + "'");
}
return dynamicDestinationResolver.resolveDestinationName(session,
resolveName(environment, destinationName), pubSubDomain);
}
};
}
示例6: myDestinationResolver
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
/**
* JAVADOC Method Level Comments
*
* @return JAVADOC.
*/
@Bean
public DestinationResolver myDestinationResolver(final Environment environment) {
return new DestinationResolver() {
private DestinationResolver dynamicDestinationResolver = new DynamicDestinationResolver();
@Override
public Destination resolveDestinationName(Session session, String destinationName,
boolean pubSubDomain) throws JMSException {
String dname = environment.getProperty("jms.destination." + destinationName,
destinationName);
if (LOG.isDebugEnabled()) {
LOG.debug("Resolved destination '" + destinationName + "' to '" + dname + "'");
}
return dynamicDestinationResolver.resolveDestinationName(session, dname,
pubSubDomain);
}
};
}
示例7: testWebSphereResourceAdapterSetup
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
public void testWebSphereResourceAdapterSetup() throws Exception {
Destination destination = new StubQueue();
DestinationResolver destinationResolver = mock(DestinationResolver.class);
given(destinationResolver.resolveDestinationName(null, "destinationname",
false)).willReturn(destination);
DefaultJmsActivationSpecFactory activationSpecFactory = new DefaultJmsActivationSpecFactory();
activationSpecFactory.setDestinationResolver(destinationResolver);
StubWebSphereActivationSpecImpl spec = (StubWebSphereActivationSpecImpl) activationSpecFactory
.createActivationSpec(new StubWebSphereResourceAdapterImpl(), activationSpecConfig);
assertEquals(destination, spec.getDestination());
assertEquals(5, spec.getMaxConcurrency());
assertEquals(3, spec.getMaxBatchSize());
}
示例8: refreshDestination
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
/**
* Refresh the JMS destination that this listener container operates on.
* <p>Called after listener setup failure, assuming that a cached Destination
* object might have become invalid (a typical case on WebLogic JMS).
* <p>The default implementation removes the destination from a
* DestinationResolver's cache, in case of a CachingDestinationResolver.
* @see #setDestinationName
* @see org.springframework.jms.support.destination.CachingDestinationResolver
*/
protected void refreshDestination() {
String destName = getDestinationName();
if (destName != null) {
DestinationResolver destResolver = getDestinationResolver();
if (destResolver instanceof CachingDestinationResolver) {
((CachingDestinationResolver) destResolver).removeFromCache(destName);
}
}
}
示例9: resolveDestination
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
/**
* Resolve the {@link Destination} to use for this instance. The {@link DestinationResolver}
* and {@link Session} can be used to resolve a destination at runtime.
* @param destinationResolver the destination resolver to use if necessary
* @param session the session to use, if necessary
* @return the {@link Destination} to use
* @throws JMSException if the DestinationResolver failed to resolve the destination
*/
public Destination resolveDestination(DestinationResolver destinationResolver, Session session)
throws JMSException {
if (this.destination instanceof Destination) {
return (Destination) this.destination;
}
if (this.destination instanceof DestinationNameHolder) {
DestinationNameHolder nameHolder = (DestinationNameHolder) this.destination;
return destinationResolver.resolveDestinationName(session,
nameHolder.destinationName, nameHolder.pubSubDomain);
}
return null;
}
示例10: getDestinationResolver
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
@Override
public DestinationResolver getDestinationResolver() {
if (this.activationSpecFactory instanceof StandardJmsActivationSpecFactory) {
return ((StandardJmsActivationSpecFactory) this.activationSpecFactory).getDestinationResolver();
}
return null;
}
示例11: createMessageListener
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
@Override
protected MessagingMessageListenerAdapter createMessageListener(MessageListenerContainer container) {
Assert.state(this.messageHandlerMethodFactory != null,
"Could not create message listener - MessageHandlerMethodFactory not set");
MessagingMessageListenerAdapter messageListener = createMessageListenerInstance();
InvocableHandlerMethod invocableHandlerMethod =
this.messageHandlerMethodFactory.createInvocableHandlerMethod(getBean(), getMethod());
messageListener.setHandlerMethod(invocableHandlerMethod);
String responseDestination = getDefaultResponseDestination();
if (StringUtils.hasText(responseDestination)) {
if (container.isReplyPubSubDomain()) {
messageListener.setDefaultResponseTopicName(responseDestination);
}
else {
messageListener.setDefaultResponseQueueName(responseDestination);
}
}
MessageConverter messageConverter = container.getMessageConverter();
if (messageConverter != null) {
messageListener.setMessageConverter(messageConverter);
}
DestinationResolver destinationResolver = container.getDestinationResolver();
if (destinationResolver != null) {
messageListener.setDestinationResolver(destinationResolver);
}
return messageListener;
}
示例12: resolveDestinationForQueue
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
@Test
public void resolveDestinationForQueue() throws JMSException {
Session session = mock(Session.class);
DestinationResolver destinationResolver = mock(DestinationResolver.class);
Destination destination = mock(Destination.class);
given(destinationResolver.resolveDestinationName(session, "myQueue", false)).willReturn(destination);
JmsResponse<String> jmsResponse = JmsResponse.forQueue("foo", "myQueue");
Destination actual = jmsResponse.resolveDestination(destinationResolver, session);
assertSame(destination, actual);
}
示例13: setExtraCollaborators
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
@Test
public void setExtraCollaborators() {
MessageConverter messageConverter = mock(MessageConverter.class);
DestinationResolver destinationResolver = mock(DestinationResolver.class);
this.container.setMessageConverter(messageConverter);
this.container.setDestinationResolver(destinationResolver);
MessagingMessageListenerAdapter listener = createInstance(this.factory,
getListenerMethod("resolveObjectPayload", MyBean.class), container);
DirectFieldAccessor accessor = new DirectFieldAccessor(listener);
assertSame(messageConverter, accessor.getPropertyValue("messageConverter"));
assertSame(destinationResolver, accessor.getPropertyValue("destinationResolver"));
}
示例14: JmsAnnotationDrivenConfiguration
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
JmsAnnotationDrivenConfiguration(
ObjectProvider<DestinationResolver> destinationResolver,
ObjectProvider<JtaTransactionManager> transactionManager,
ObjectProvider<MessageConverter> messageConverter, JmsProperties properties) {
this.destinationResolver = destinationResolver;
this.transactionManager = transactionManager;
this.messageConverter = messageConverter;
this.properties = properties;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:JmsAnnotationDrivenConfiguration.java
示例15: destinationResolver
import org.springframework.jms.support.destination.DestinationResolver; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(DestinationResolver.class)
public JndiDestinationResolver destinationResolver() {
JndiDestinationResolver resolver = new JndiDestinationResolver();
resolver.setFallbackToDynamicDestination(true);
return resolver;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:JmsAnnotationDrivenConfiguration.java