You are here

function services_client_queue_data in Services Client 7

Store data to queue for next processing.

Parameters

$src_data: Source data that would be sent to services module

$type: Type of hook

1 call to services_client_queue_data()
services_client_data_process in ./services_client.module
This function takes inbound data objects and a type and determines if there are tasks for them. If there are, it checks conditions and then generates connections and organizes the data to pass to the calling functions

File

./services_client.module, line 1072
Services client module allows to push different types of objects on different types of events such as node_save, user_save to remote masters.

Code

function services_client_queue_data($src_data, $type) {
  if (isset($src_data->_services_client)) {

    // If data should be processed in queue check if data haven't been queued
    // already and are processed from queue. If not add custom mark 'queued' and
    // send data to queue
    if (variable_get('services_client_use_queue', TRUE) && empty($src_data->_services_client['queued']) && empty($src_data->_services_client['bypass_queue'])) {

      // Mark data as queued
      $src_data->_services_client['queued'] = TRUE;

      // Get queue
      $queue = DrupalQueue::get('services_client_sync', TRUE);

      // Enqueue data
      return $queue
        ->createItem(array(
        'src_data' => $src_data,
        'type' => $type,
      ));
    }
  }
  return FALSE;
}