Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2002-2014 the original author or authors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.springframework.messaging.core;
 
 import java.util.Map;
 
An extension of AbstractMessagingTemplate that adds operations for sending messages to a resolvable destination name as defined by the following interfaces:

Author(s):
Mark Fisher
Rossen Stoyanchev
Since:
4.0
 
 
 	private volatile DestinationResolver<D> destinationResolver;


Configure the DestinationResolver to use to resolve String destination names into actual destinations of type <D>.

This field does not have a default setting. If not configured, methods that require resolving a destination name will raise an java.lang.IllegalArgumentException.

Parameters:
destinationResolver the destination resolver to use
 
 	public void setDestinationResolver(DestinationResolver<D> destinationResolver) {
 		Assert.notNull(destinationResolver"'destinationResolver' is required");
 		this. = destinationResolver;
 	}

Return the configured destination resolver.
 
 		return this.;
 	}
 
 
 	public void send(String destinationNameMessage<?> message) {
 		D destination = resolveDestination(destinationName);
 		doSend(destinationmessage);
 	}
 
 	protected final D resolveDestination(String destinationName) {
 		Assert.state(this. != null"DestinationResolver is required to resolve destination names");
 		return this..resolveDestination(destinationName);
 	}
 
 	public <T> void convertAndSend(String destinationName, T payload) {
 		convertAndSend(destinationNamepayloadnullnull);
 	}
 
 	public <T> void convertAndSend(String destinationName, T payloadMap<StringObjectheaders) {
 		convertAndSend(destinationNamepayloadheadersnull);
 	}
 
 	public <T> void convertAndSend(String destinationName, T payloadMessagePostProcessor postProcessor) {
 		convertAndSend(destinationNamepayloadnullpostProcessor);
 	}
 
 	public <T> void convertAndSend(String destinationName, T payloadMap<StringObjectheadersMessagePostProcessor postProcessor) {
 		D destination = resolveDestination(destinationName);
 		super.convertAndSend(destinationpayloadheaderspostProcessor);
 	}
 
 	public Message<?> receive(String destinationName) {
 		D destination = resolveDestination(destinationName);
		return super.receive(destination);
	}
	public <T> T receiveAndConvert(String destinationNameClass<T> targetClass) {
destination = resolveDestination(destinationName);
		return super.receiveAndConvert(destinationtargetClass);
	}
	public Message<?> sendAndReceive(String destinationNameMessage<?> requestMessage) {
destination = resolveDestination(destinationName);
		return super.sendAndReceive(destinationrequestMessage);
	}
	public <T> T convertSendAndReceive(String destinationNameObject requestClass<T> targetClass) {
destination = resolveDestination(destinationName);
		return super.convertSendAndReceive(destinationrequesttargetClass);
	}
	public <T> T convertSendAndReceive(String destinationNameObject requestMap<StringObjectheaders,
			Class<T> targetClass) {
destination = resolveDestination(destinationName);
		return super.convertSendAndReceive(destinationrequestheaderstargetClass);
	}
	public <T> T convertSendAndReceive(String destinationNameObject requestClass<T> targetClass,
			MessagePostProcessor postProcessor) {
destination = resolveDestination(destinationName);
		return super.convertSendAndReceive(destinationrequesttargetClasspostProcessor);
	}
	public <T> T convertSendAndReceive(String destinationNameObject requestMap<StringObjectheaders,
			Class<T> targetClassMessagePostProcessor postProcessor) {
destination = resolveDestination(destinationName);
		return super.convertSendAndReceive(destinationrequestheaderstargetClasspostProcessor);
	}
New to GrepCode? Check out our FAQ X