Omeka_Job_Dispatcher_Default
Package: Job\Dispatcher
- class Omeka_Job_Dispatcher_Default
implements Omeka_Job_Dispatcher_DispatcherInterface
Dispatches jobs in Omeka.
This provides a clean interface to adapter classes that deal with the details of how to dispatch jobs. It is initialized in the Jobs bootstrap resource and can be accessed via the registry.
Standard usage, where Job_Class_Name corresponds to a valid class name for a class implementing Omeka_JobInterface:
<code> $dispatcher = Zend_Registry::get(‘job_dispatcher’); $dispatcher->send(‘Job_Class_Name’, array(
‘firstOption’ => ‘text’, ‘secondOption’ => 2
)); </code>
- Omeka_Job_Dispatcher_Default::__construct(Omeka_Job_Dispatcher_Adapter_AdapterInterface $defaultAdapter, Omeka_Job_Dispatcher_Adapter_AdapterInterface $longRunningAdapter, $user)
- Parameters:
$defaultAdapter (
Omeka_Job_Dispatcher_Adapter_AdapterInterface
) –$longRunningAdapter (
Omeka_Job_Dispatcher_Adapter_AdapterInterface
) –$user (
User|null
) – The user account associated with the request, i.e. the user account associated with jobs sent by the dispatcher.
- Omeka_Job_Dispatcher_Default::setUser($user)
Set the user.
- Parameters:
$user (
User|null
) –
- Omeka_Job_Dispatcher_Default::getUser()
Get the user.
- Returns:
User|null
- Omeka_Job_Dispatcher_Default::setDefaultAdapter(Omeka_Job_Dispatcher_Adapter_AdapterInterface $defaultAdapter)
Set the default adapter.
- Parameters:
$defaultAdapter (
Omeka_Job_Dispatcher_Adapter_AdapterInterface
) –
- Omeka_Job_Dispatcher_Default::setLongRunningAdapter(Omeka_Job_Dispatcher_Adapter_AdapterInterface $longRunningAdapter)
Set the long running adapter.
- Parameters:
$longRunningAdapter (
Omeka_Job_Dispatcher_Adapter_AdapterInterface
) –
- Omeka_Job_Dispatcher_Default::setQueueName($name)
Set the name of the queue to which default jobs will be sent.
NOTE: This may be ignored by adapters that do not understand the notion of named queues (or queues in general).
- Parameters:
$name (
string
) –
- Omeka_Job_Dispatcher_Default::setQueueNameLongRunning($name)
Set the name of the queue to which long-running jobs will be sent.
NOTE: This may be ignored by adapters that do not understand the notion of named queues (or queues in general).
- Parameters:
$name (
string
) –
- Omeka_Job_Dispatcher_Default::send($jobClass, $options = array())
Dispatch a job using the default dispatcher.
- Parameters:
$jobClass (
string
) – Class name that implements Omeka_JobInterface.$options (
array
) – Optional associative array containing options that the task needs in order to do its job. Note that all options should be primitive data types (or arrays containing primitive data types).
- Omeka_Job_Dispatcher_Default::sendLongRunning($jobClass, $options = array())
Dispatch a job using the long-running dispatcher.
- Parameters:
$jobClass (
string
) – Name of a class that implements Omeka_JobInterface.$options (
array
) – Optional associative array containing options that the task needs in order to do its job. Note that all options should be primitive data types (or arrays containing primitive data types).
- Omeka_Job_Dispatcher_Default::_getJobMetadata($class, $options)
- Parameters:
$class –
$options –
- Omeka_Job_Dispatcher_Default::_toJson($metadata)
- Parameters:
$metadata –