@UriEndpoint(firstVersion="3.0",
scheme="soroush",
title="Soroush",
syntax="soroush:action",
category=CHAT)
public class SoroushBotEndpoint
extends org.apache.camel.support.DefaultEndpoint
| Constructor and Description |
|---|
SoroushBotEndpoint(String endpointUri,
SoroushBotComponent component) |
| Modifier and Type | Method and Description |
|---|---|
org.apache.camel.Consumer |
createConsumer(org.apache.camel.Processor processor)
create consumer based on concurrentConsumers value, if concurrentConsumers is greater than 1, we use
SoroushBotMultiThreadConsumer that use a thread pool in order to process exchanges. |
org.apache.camel.Producer |
createProducer()
create producer based on uri
SoroushAction |
SoroushAction |
getAction() |
String |
getAuthorizationToken() |
String |
getBackOffStrategy() |
BackOffStrategy |
getBackOffStrategyHelper() |
int |
getConcurrentConsumers() |
int |
getConnectionTimeout() |
int |
getMaxConnectionRetry() |
long |
getMaxRetryWaitingTime() |
int |
getQueueCapacityPerThread() |
long |
getReconnectIdleConnectionTimeout() |
long |
getRetryExponentialCoefficient() |
long |
getRetryLinearIncrement() |
long |
getRetryWaitingTime() |
void |
handleDownloadFiles(SoroushMessage message)
check whether
SoroushMessage.fileUrl(SoroushMessage.thumbnailUrl) is null or not, and download
the resource if it is not null this function only set SoroushMessage.file to InputStream get from
Response.readEntity(Class) )} and does not store the resource in file. |
boolean |
isAutoDownload() |
boolean |
isAutoUploadFile() |
boolean |
isDownloadThumbnail() |
boolean |
isForceDownload() |
boolean |
isForceUpload() |
void |
setAction(SoroushAction action) |
void |
setAuthorizationToken(String authorizationToken) |
void |
setAutoDownload(boolean autoDownload) |
void |
setAutoUploadFile(boolean autoUploadFile) |
void |
setBackOffStrategy(String backOffStrategy) |
void |
setBackOffStrategyHelper(BackOffStrategy backOffStrategyHelper) |
void |
setConcurrentConsumers(int concurrentConsumers) |
void |
setConnectionTimeout(int connectionTimeout) |
void |
setDownloadThumbnail(boolean downloadThumbnail) |
void |
setForceDownload(boolean forceDownload) |
void |
setForceUpload(boolean forceUpload) |
void |
setMaxConnectionRetry(int maxConnectionRetry) |
void |
setMaxRetryWaitingTime(long maxRetryWaitingTime) |
void |
setQueueCapacityPerThread(int queueCapacityPerThread) |
void |
setReconnectIdleConnectionTimeout(long reconnectIdleConnectionTimeout) |
void |
setRetryExponentialCoefficient(long retryExponentialCoefficient) |
void |
setRetryLinearIncrement(long retryLinearIncrement) |
void |
setRetryWaitingTime(long retryWaitingTime) |
void |
setSendMessageTarget(javax.ws.rs.client.WebTarget sendMessageTarget) |
void |
setUploadFileTarget(javax.ws.rs.client.WebTarget uploadFileTarget) |
void |
waitBeforeRetry(int retryCount) |
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, doStart, doStop, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toStringbuild, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic SoroushBotEndpoint(String endpointUri, SoroushBotComponent component)
public org.apache.camel.Producer createProducer()
SoroushActionpublic org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor)
throws Exception
SoroushBotMultiThreadConsumer that use a thread pool in order to process exchanges. the consumer use
multiple queue to ensure that every message from a same user goes to the same thread and therefore every message
from the same user will be processed in the order of arrival time.
if concurrentConsumers is lower than 2 then we use SoroushBotSingleThreadConsumer that process all
received message in the order of their arrival time.
processor - processorExceptionpublic SoroushAction getAction()
public void setAction(SoroushAction action)
public String getAuthorizationToken()
public void setAuthorizationToken(String authorizationToken)
public int getConnectionTimeout()
public void setConnectionTimeout(int connectionTimeout)
public int getMaxConnectionRetry()
public void setMaxConnectionRetry(int maxConnectionRetry)
public int getConcurrentConsumers()
public void setConcurrentConsumers(int concurrentConsumers)
public int getQueueCapacityPerThread()
public void setQueueCapacityPerThread(int queueCapacityPerThread)
public boolean isAutoUploadFile()
public void setAutoUploadFile(boolean autoUploadFile)
public boolean isForceUpload()
public void setForceUpload(boolean forceUpload)
public boolean isDownloadThumbnail()
public void setDownloadThumbnail(boolean downloadThumbnail)
public boolean isForceDownload()
public void setForceDownload(boolean forceDownload)
public boolean isAutoDownload()
public void setAutoDownload(boolean autoDownload)
public long getRetryWaitingTime()
public void setRetryWaitingTime(long retryWaitingTime)
public String getBackOffStrategy()
public void setBackOffStrategy(String backOffStrategy)
public long getRetryExponentialCoefficient()
public void setRetryExponentialCoefficient(long retryExponentialCoefficient)
public long getRetryLinearIncrement()
public void setRetryLinearIncrement(long retryLinearIncrement)
public long getMaxRetryWaitingTime()
public void setMaxRetryWaitingTime(long maxRetryWaitingTime)
public long getReconnectIdleConnectionTimeout()
public void setReconnectIdleConnectionTimeout(long reconnectIdleConnectionTimeout)
public void setUploadFileTarget(javax.ws.rs.client.WebTarget uploadFileTarget)
public void setSendMessageTarget(javax.ws.rs.client.WebTarget sendMessageTarget)
public BackOffStrategy getBackOffStrategyHelper()
public void setBackOffStrategyHelper(BackOffStrategy backOffStrategyHelper)
public void handleDownloadFiles(SoroushMessage message) throws SoroushException
SoroushMessage.fileUrl(SoroushMessage.thumbnailUrl) is null or not, and download
the resource if it is not null this function only set SoroushMessage.file to InputStream get from
Response.readEntity(Class) )} and does not store the resource in file.SoroushException - if the file does not exists on soroush or soroush reject the requestpublic void waitBeforeRetry(int retryCount)
throws InterruptedException
InterruptedExceptionApache Camel