Omeka_Job_Dispatcher_Default

class Omeka_Job_Dispatcher_Default

Package: Job\Dispatcher

Dispatches jobs in Omeka.

This provides a clean interface to adapter classes that deal with the detailsof how to dispatch jobs. It is initialized in the Jobs bootstrap resource andcan be accessed via the registry.

Standard usage, where Job_Class_Name corresponds to a valid class name for a class implementing Omeka_JobInterface:

$dispatcher = Zend_Registry::get('job_dispatcher');
$dispatcher->send('Job_Class_Name', array(
     'firstOption' => 'text',
     'secondOption' => 2
));
property _defaultAdapter
property _longRunningAdapter
property _user
__construct(Omeka_Job_Dispatcher_Adapter_AdapterInterface $defaultAdapter, Omeka_Job_Dispatcher_Adapter_AdapterInterface $longRunningAdapter, User|null $user)
Parameters:
setUser(User|null $user)

Set the user.

Parameters:
  • $user (User|null) –
getUser()

Get the user.

Returns:User|null
setDefaultAdapter(Omeka_Job_Dispatcher_Adapter_AdapterInterface $defaultAdapter)

Set the default adapter.

Parameters:
setLongRunningAdapter(Omeka_Job_Dispatcher_Adapter_AdapterInterface $longRunningAdapter)

Set the long running adapter.

Parameters:
setQueueName(string $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 notionof named queues (or queues in general).

Parameters:
  • $name (string) –
setQueueNameLongRunning(string $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 notionof named queues (or queues in general).

Parameters:
  • $name (string) –
send(string $jobClass, array $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).
sendLongRunning(string $jobClass, array $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).
_getJobMetadata($class, $options)
Parameters:
  • $class (unknown) –
  • $options (unknown) –
_toJson($metadata)
Parameters:
  • $metadata (unknown) –

Project Versions

Previous topic

Libraries/Omeka/Job/Dispatcher

Next topic

Omeka_Job_Dispatcher_DispatcherInterface

This Page