Package org.apache.ofbiz.service
Interface LocalDispatcher
- All Known Implementing Classes:
GenericAbstractDispatcher
public interface LocalDispatcher
A local service dispatcher. This is the main API for the service engine.
Instances of LocalDispatcher
are based on a Delegator
instance and an entity model reader name. You can get a LocalDispatcher
instance
by calling the ServiceDispatcher.getLocalDispatcher(String, Delegator)
factory method.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCommitService
(String serviceName, boolean persist, Object... context) void
addCommitService
(String serviceName, Map<String, ? extends Object> context, boolean persist) Adds a commit service to the current TX using ServiceSynchronizationvoid
addRollbackService
(String serviceName, boolean persist, Object... context) void
addRollbackService
(String serviceName, Map<String, ? extends Object> context, boolean persist) Adds a rollback service to the current TX using ServiceSynchronizationvoid
De-Registers this LocalDispatchervoid
Disables running of Service Engine Condition Actions (SECAs).void
Reenables running of Service Engine Condition Actions (SECAs).Gets the GenericEntityDelegator associated with this dispatcherReturns the DispatchContext created by this dispatcherGets the JmsListenerFactory which holds the message listeners.Gets the JobManager associated with this dispatchergetName()
Returns the Name of this local dispatcherGets the Security object associated with this dispatcherboolean
Returns whether Service Engine Condition Actions (SECAs) are disabled or not.void
registerCallback
(String serviceName, GenericServiceCallback cb) Register a callback listener on a specific service.void
void
Run the service asynchronously and IGNORE the result.void
Run the service asynchronously and IGNORE the result.void
Run the service asynchronously, passing an instance of GenericRequester that will receive the result.void
runAsync
(String serviceName, Map<String, ? extends Object> context, GenericRequester requester, boolean persist) Run the service asynchronously, passing an instance of GenericRequester that will receive the result.void
runAsync
(String serviceName, Map<String, ? extends Object> context, GenericRequester requester, boolean persist, int transactionTimeout, boolean requireNewTransaction) Run the service asynchronously, passing an instance of GenericRequester that will receive the result.void
runAsync
(String serviceName, GenericRequester requester, boolean persist, int transactionTimeout, boolean requireNewTransaction, Object... context) void
runAsync
(String serviceName, GenericRequester requester, boolean persist, Object... context) void
runAsync
(String serviceName, GenericRequester requester, Object... context) runAsyncWait
(String serviceName, boolean persist, Object... context) runAsyncWait
(String serviceName, Map<String, ? extends Object> context) Run the service asynchronously.runAsyncWait
(String serviceName, Map<String, ? extends Object> context, boolean persist) Run the service asynchronously.runSync
(String serviceName, int transactionTimeout, boolean requireNewTransaction, Object... context) Run the service synchronously and return the result.runSync
(String serviceName, Map<String, ? extends Object> context, int transactionTimeout, boolean requireNewTransaction) Run the service synchronously with a specified timeout and return the result.void
runSyncIgnore
(String serviceName, int transactionTimeout, boolean requireNewTransaction, Object... context) void
runSyncIgnore
(String serviceName, Map<String, ? extends Object> context) Run the service synchronously and IGNORE the result.void
runSyncIgnore
(String serviceName, Map<String, ? extends Object> context, int transactionTimeout, boolean requireNewTransaction) Run the service synchronously with a specified timeout and IGNORE the result.void
schedule
(String serviceName, long startTime, int frequency, int interval, int count, long endTime, Object... context) void
schedule
(String serviceName, long startTime, int frequency, int interval, int count, Object... context) void
schedule
(String serviceName, long startTime, int frequency, int interval, long endTime, Object... context) void
void
schedule
(String poolName, String serviceName, long startTime, int frequency, int interval, int count, long endTime, int maxRetry, Object... context) void
schedule
(String jobName, String poolName, String serviceName, long startTime, int frequency, int interval, int count, long endTime, int maxRetry, Object... context) void
schedule
(String jobName, String poolName, String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count, long endTime, int maxRetry) Schedule a service to run asynchronously at a specific start time.void
schedule
(String poolName, String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count, long endTime, int maxRetry) Schedule a service to run asynchronously at a specific start time.void
Schedule a service to run asynchronously at a specific start time.void
schedule
(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count) Schedule a service to run asynchronously at a specific start time.void
schedule
(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count, long endTime) Schedule a service to run asynchronously at a specific start time.void
schedule
(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, long endTime) Schedule a service to run asynchronously at a specific start time.
-
Method Details
-
disableEcas
void disableEcas()Disables running of Service Engine Condition Actions (SECAs). Intended to be turned off temporarily. -
enableEcas
void enableEcas()Reenables running of Service Engine Condition Actions (SECAs). -
isEcasDisabled
boolean isEcasDisabled()Returns whether Service Engine Condition Actions (SECAs) are disabled or not.- Returns:
- returns whether Service Engine Condition Actions (SECAs) are disabled or not.
-
runSync
Map<String,Object> runSync(String serviceName, Map<String, ? extends Object> context) throws GenericServiceExceptionRun the service synchronously and return the result.- Parameters:
serviceName
- Name of the service to run.context
- Map of name, value pairs composing the context.- Returns:
- Map of name, value pairs composing the result.
- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runSync
Map<String,Object> runSync(String serviceName, Map<String, ? extends Object> context, int transactionTimeout, boolean requireNewTransaction) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service synchronously with a specified timeout and return the result.- Parameters:
serviceName
- Name of the service to run.context
- Map of name, value pairs composing the context.transactionTimeout
- the overriding timeout for the transaction (if we started it).requireNewTransaction
- if true we will suspend and create a new transaction so we are sure to start.- Returns:
- Map of name, value pairs composing the result.
- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runSync
Map<String,Object> runSync(String serviceName, int transactionTimeout, boolean requireNewTransaction, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException -
runSyncIgnore
void runSyncIgnore(String serviceName, Map<String, ? extends Object> context) throws GenericServiceExceptionRun the service synchronously and IGNORE the result.- Parameters:
serviceName
- Name of the service to run.context
- Map of name, value pairs composing the context.- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runSyncIgnore
void runSyncIgnore(String serviceName, Map<String, ? extends Object> context, int transactionTimeout, boolean requireNewTransaction) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service synchronously with a specified timeout and IGNORE the result.- Parameters:
serviceName
- Name of the service to run.context
- Map of name, value pairs composing the context.transactionTimeout
- the overriding timeout for the transaction (if we started it).requireNewTransaction
- if true we will suspend and create a new transaction so we are sure to start.- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runSyncIgnore
void runSyncIgnore(String serviceName, int transactionTimeout, boolean requireNewTransaction, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException -
runAsync
void runAsync(String serviceName, Map<String, ? extends Object> context, GenericRequester requester, boolean persist, int transactionTimeout, boolean requireNewTransaction) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service asynchronously, passing an instance of GenericRequester that will receive the result.- Parameters:
serviceName
- Name of the service to run.context
- Map of name, value pairs composing the context.requester
- Object implementing GenericRequester interface which will receive the result.persist
- True for store/run; False for run.transactionTimeout
- the overriding timeout for the transaction (if we started it).requireNewTransaction
- if true we will suspend and create a new transaction so we are sure to start.- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runAsync
void runAsync(String serviceName, GenericRequester requester, boolean persist, int transactionTimeout, boolean requireNewTransaction, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException -
runAsync
void runAsync(String serviceName, Map<String, ? extends Object> context, GenericRequester requester, boolean persist) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service asynchronously, passing an instance of GenericRequester that will receive the result.- Parameters:
serviceName
- Name of the service to run.context
- Map of name, value pairs composing the context.requester
- Object implementing GenericRequester interface which will receive the result.persist
- True for store/run; False for run.- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runAsync
void runAsync(String serviceName, GenericRequester requester, boolean persist, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException -
runAsync
void runAsync(String serviceName, Map<String, ? extends Object> context, GenericRequester requester) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service asynchronously, passing an instance of GenericRequester that will receive the result. This method WILL persist the job.- Parameters:
serviceName
- Name of the service to run.context
- Map of name, value pairs composing the context.requester
- Object implementing GenericRequester interface which will receive the result.- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runAsync
void runAsync(String serviceName, GenericRequester requester, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException -
runAsync
void runAsync(String serviceName, Map<String, ? extends Object> context, boolean persist) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service asynchronously and IGNORE the result.- Parameters:
serviceName
- Name of the service to run.context
- Map of name, value pairs composing the context.persist
- True for store/run; False for run.- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runAsync
void runAsync(String serviceName, boolean persist, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException -
runAsync
void runAsync(String serviceName, Map<String, ? extends Object> context) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service asynchronously and IGNORE the result. This method WILL persist the job.- Parameters:
serviceName
- Name of the service to run.context
- Map of name, value pairs composing the context.- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runAsyncWait
GenericResultWaiter runAsyncWait(String serviceName, Map<String, ? extends Object> context, boolean persist) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service asynchronously.- Parameters:
serviceName
- Name of the service to run.context
- Map of name, value pairs composing the context.persist
- True for store/run; False for run.- Returns:
- A new GenericRequester object.
- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runAsyncWait
GenericResultWaiter runAsyncWait(String serviceName, boolean persist, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException -
runAsyncWait
GenericResultWaiter runAsyncWait(String serviceName, Map<String, ? extends Object> context) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service asynchronously. This method WILL persist the job.- Parameters:
serviceName
- Name of the service to run.context
- Map of name, value pairs composing the context.- Returns:
- A new GenericRequester object.
- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
registerCallback
Register a callback listener on a specific service.- Parameters:
serviceName
- Name of the service to link callback to.cb
- The callback implementation.
-
schedule
void schedule(String poolName, String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count, long endTime, int maxRetry) throws GenericServiceExceptionSchedule a service to run asynchronously at a specific start time.- Parameters:
poolName
- Name of the service pool to send to.serviceName
- Name of the service to invoke.context
- The name/value pairs composing the context.startTime
- The time to run this service.frequency
- The frequency of the recurrence (RecurrenceRule.DAILY, etc).interval
- The interval of the frequency recurrence.count
- The number of times to repeat.endTime
- The time in milliseconds the service should expiremaxRetry
- The number of times we should retry on failure- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
schedule
void schedule(String poolName, String serviceName, long startTime, int frequency, int interval, int count, long endTime, int maxRetry, Object... context) throws GenericServiceException - Throws:
GenericServiceException
-
schedule
void schedule(String jobName, String poolName, String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count, long endTime, int maxRetry) throws GenericServiceExceptionSchedule a service to run asynchronously at a specific start time.- Parameters:
jobName
- Name of the jobpoolName
- Name of the service pool to send to.serviceName
- Name of the service to invoke.context
- The name/value pairs composing the context.startTime
- The time to run this service.frequency
- The frequency of the recurrence (RecurrenceRule.DAILY, etc).interval
- The interval of the frequency recurrence.count
- The number of times to repeat.endTime
- The time in milliseconds the service should expiremaxRetry
- The number of times we should retry on failure- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
schedule
void schedule(String jobName, String poolName, String serviceName, long startTime, int frequency, int interval, int count, long endTime, int maxRetry, Object... context) throws GenericServiceException - Throws:
GenericServiceException
-
schedule
void schedule(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count, long endTime) throws GenericServiceExceptionSchedule a service to run asynchronously at a specific start time.- Parameters:
serviceName
- Name of the service to invoke.context
- The name/value pairs composing the context.startTime
- The time to run this service.frequency
- The frequency of the recurrence (RecurrenceRule.DAILY, etc).interval
- The interval of the frequency recurrence.count
- The number of times to repeat.endTime
- The time in milliseconds the service should expire- Throws:
GenericServiceException
-
schedule
void schedule(String serviceName, long startTime, int frequency, int interval, int count, long endTime, Object... context) throws GenericServiceException - Throws:
GenericServiceException
-
schedule
void schedule(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count) throws GenericServiceExceptionSchedule a service to run asynchronously at a specific start time.- Parameters:
serviceName
- Name of the service to invoke.context
- The name/value pairs composing the context.startTime
- The time to run this service.frequency
- The frequency of the recurrence (RecurrenceRule.DAILY, etc).interval
- The interval of the frequency recurrence.count
- The number of times to repeat.- Throws:
GenericServiceException
-
schedule
void schedule(String serviceName, long startTime, int frequency, int interval, int count, Object... context) throws GenericServiceException - Throws:
GenericServiceException
-
schedule
void schedule(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, long endTime) throws GenericServiceExceptionSchedule a service to run asynchronously at a specific start time.- Parameters:
serviceName
- Name of the service to invoke.context
- The name/value pairs composing the context.startTime
- The time to run this service.frequency
- The frequency of the recurrence (RecurrenceRule.DAILY, etc).interval
- The interval of the frequency recurrence.endTime
- The time in milliseconds the service should expire- Throws:
GenericServiceException
-
schedule
void schedule(String serviceName, long startTime, int frequency, int interval, long endTime, Object... context) throws GenericServiceException - Throws:
GenericServiceException
-
schedule
void schedule(String serviceName, Map<String, ? extends Object> context, long startTime) throws GenericServiceExceptionSchedule a service to run asynchronously at a specific start time.- Parameters:
serviceName
- Name of the service to invoke.context
- The name/value pairs composing the context.startTime
- The time to run this service.- Throws:
GenericServiceException
-
schedule
- Throws:
GenericServiceException
-
addRollbackService
void addRollbackService(String serviceName, Map<String, ? extends Object> context, boolean persist) throws GenericServiceExceptionAdds a rollback service to the current TX using ServiceSynchronization- Parameters:
serviceName
-context
-persist
-- Throws:
GenericServiceException
-
addRollbackService
void addRollbackService(String serviceName, boolean persist, Object... context) throws GenericServiceException - Throws:
GenericServiceException
-
addCommitService
void addCommitService(String serviceName, Map<String, ? extends Object> context, boolean persist) throws GenericServiceExceptionAdds a commit service to the current TX using ServiceSynchronization- Parameters:
serviceName
-context
-persist
-- Throws:
GenericServiceException
-
addCommitService
void addCommitService(String serviceName, boolean persist, Object... context) throws GenericServiceException - Throws:
GenericServiceException
-
getJobManager
JobManager getJobManager()Gets the JobManager associated with this dispatcher- Returns:
- JobManager that is associated with this dispatcher
-
getJMSListeneFactory
JmsListenerFactory getJMSListeneFactory()Gets the JmsListenerFactory which holds the message listeners.- Returns:
- JmsListenerFactory
-
getDelegator
Delegator getDelegator()Gets the GenericEntityDelegator associated with this dispatcher- Returns:
- GenericEntityDelegator associated with this dispatcher
-
getSecurity
Security getSecurity()Gets the Security object associated with this dispatcher- Returns:
- Security object associated with this dispatcher
-
getName
String getName()Returns the Name of this local dispatcher- Returns:
- String representing the name of this local dispatcher
-
getDispatchContext
DispatchContext getDispatchContext()Returns the DispatchContext created by this dispatcher- Returns:
- DispatchContext created by this dispatcher
-
deregister
void deregister()De-Registers this LocalDispatcher
-