public class SimpleMessageListenerContainer extends Object
| Constructor and Description |
|---|
SimpleMessageListenerContainer() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected org.springframework.core.task.TaskExecutor |
createDefaultTaskExecutor()
Create a default TaskExecutor.
|
void |
destroy() |
protected void |
doDestroy() |
protected void |
doStart() |
protected void |
doStop() |
protected void |
executeMessage(org.springframework.messaging.Message<String> stringMessage) |
protected com.amazonaws.services.sqs.AmazonSQS |
getAmazonSqs() |
protected String |
getBeanName() |
protected org.springframework.messaging.core.DestinationResolver<String> |
getDestinationResolver() |
protected org.springframework.util.ErrorHandler |
getErrorHandler() |
protected Object |
getLifecycleMonitor() |
protected org.slf4j.Logger |
getLogger() |
protected Integer |
getMaxNumberOfMessages() |
protected QueueMessageHandler |
getMessageHandler() |
Map<String,com.amazonaws.services.sqs.model.ReceiveMessageRequest> |
getMessageRequests() |
int |
getPhase() |
protected org.springframework.core.task.TaskExecutor |
getTaskExecutor() |
protected Integer |
getVisibilityTimeout() |
protected Integer |
getWaitTimeOut() |
protected void |
handleError(Throwable throwable) |
protected void |
initialize() |
boolean |
isActive() |
boolean |
isAutoStartup() |
boolean |
isRunning() |
void |
setAmazonSqs(com.amazonaws.services.sqs.AmazonSQS amazonSqs)
Configures the mandatory
AmazonSQS client for this instance. |
void |
setAutoStartup(boolean autoStartup)
Configures if this container should be automatically started.
|
void |
setBeanName(String name) |
void |
setDestinationResolver(org.springframework.messaging.core.DestinationResolver<String> destinationResolver)
Configures the destination resolver used to retrieve the queue url based on the destination name configured for
this instance.
|
void |
setErrorHandler(org.springframework.util.ErrorHandler errorHandler)
A custom error handler that will be called in case of any message listener error.
|
void |
setMaxNumberOfMessages(Integer maxNumberOfMessages)
Configure the maximum number of messages that should be retrieved during one poll to the Amazon SQS system.
|
void |
setMessageHandler(QueueMessageHandler messageHandler) |
void |
setPhase(int phase)
Configure a custom phase for the container to start.
|
void |
setResourceIdResolver(org.springframework.cloud.aws.core.env.ResourceIdResolver resourceIdResolver)
This value must be set if no destination resolver has been set.
|
void |
setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor) |
void |
setVisibilityTimeout(Integer visibilityTimeout)
Configures the duration (in seconds) that the received messages are hidden from
subsequent poll requests after being retrieved from the system.
|
void |
setWaitTimeOut(Integer waitTimeOut)
Configures the wait timeout that the poll request will wait for new message to arrive if the are currently no
messages on the queue.
|
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
protected void |
validateConfiguration() |
protected org.springframework.core.task.TaskExecutor getTaskExecutor()
public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
protected void initialize()
protected void doStart()
protected void doStop()
protected void doDestroy()
protected org.springframework.core.task.TaskExecutor createDefaultTaskExecutor()
The default implementation builds a SimpleAsyncTaskExecutor
with the specified bean name (or the class name, if no bean name specified) as thread name prefix.
SimpleAsyncTaskExecutor configured with the thread name prefixSimpleAsyncTaskExecutor.SimpleAsyncTaskExecutor(String)protected void executeMessage(org.springframework.messaging.Message<String> stringMessage)
public Map<String,com.amazonaws.services.sqs.model.ReceiveMessageRequest> getMessageRequests()
protected QueueMessageHandler getMessageHandler()
public void setMessageHandler(QueueMessageHandler messageHandler)
protected Object getLifecycleMonitor()
protected org.slf4j.Logger getLogger()
protected com.amazonaws.services.sqs.AmazonSQS getAmazonSqs()
public void setAmazonSqs(com.amazonaws.services.sqs.AmazonSQS amazonSqs)
AmazonSQS client for this instance.
Note:The configured instance should have a buffering amazon SQS instance (see subclasses) functionality
to
improve the performance during message reception and deletion on the queueing system.amazonSqs - the amazon sqs instance. Must not be nullprotected org.springframework.messaging.core.DestinationResolver<String> getDestinationResolver()
public void setDestinationResolver(org.springframework.messaging.core.DestinationResolver<String> destinationResolver)
destinationResolver - - the destination resolver. Must not be nullprotected String getBeanName()
public void setBeanName(String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwareprotected Integer getMaxNumberOfMessages()
public void setMaxNumberOfMessages(Integer maxNumberOfMessages)
maxNumberOfMessages - the maximum number of messages (between 1-10)protected Integer getVisibilityTimeout()
public void setVisibilityTimeout(Integer visibilityTimeout)
visibilityTimeout - the visibility timeout in secondspublic void setResourceIdResolver(org.springframework.cloud.aws.core.env.ResourceIdResolver resourceIdResolver)
resourceIdResolver - the resourceIdResolver to use for resolving logical to physical ids in a CloudFormation environment.
Must not be null.protected Integer getWaitTimeOut()
public void setWaitTimeOut(Integer waitTimeOut)
waitTimeOut - - the wait time out in secondspublic boolean isAutoStartup()
isAutoStartup in interface org.springframework.context.SmartLifecyclepublic void setAutoStartup(boolean autoStartup)
autoStartup - - false if the container will be manually startedpublic void stop(Runnable callback)
stop in interface org.springframework.context.SmartLifecyclepublic int getPhase()
getPhase in interface org.springframework.context.Phasedpublic void setPhase(int phase)
SmartLifecycle interface.phase - - the phase that defines the phase respecting the Ordered semanticsprotected org.springframework.util.ErrorHandler getErrorHandler()
public void setErrorHandler(org.springframework.util.ErrorHandler errorHandler)
errorHandler - custom error handler implementationpublic boolean isActive()
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionprotected void validateConfiguration()
public void start()
start in interface org.springframework.context.Lifecyclepublic void stop()
stop in interface org.springframework.context.Lifecyclepublic boolean isRunning()
isRunning in interface org.springframework.context.Lifecyclepublic void destroy()
destroy in interface org.springframework.beans.factory.DisposableBeanprotected void handleError(Throwable throwable)
Copyright © 2014 Pivotal Software, Inc.. All rights reserved.