本文整理汇总了PHP中owa_coreAPI::getEventQueue方法的典型用法代码示例。如果您正苦于以下问题:PHP owa_coreAPI::getEventQueue方法的具体用法?PHP owa_coreAPI::getEventQueue怎么用?PHP owa_coreAPI::getEventQueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类owa_coreAPI
的用法示例。
在下文中一共展示了owa_coreAPI::getEventQueue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
function action()
{
if ($this->getParam('queues')) {
$queues = $this->getParam('queues');
} else {
$queues = 'incoming_tracking_events,processing';
}
if ($this->getParam('interval')) {
$interval = $this->getParam('interval');
} else {
$interval = 3600 * 24;
}
// pull list of event queues to process from command line
$queues = $this->getParam('queues');
if ($queues) {
// parse command line
$queues = explode(',', $this->getParam('queues'));
} else {
// get whatever queues are registered by modules
$s = owa_coreAPI::serviceSingleton();
$queues = array_keys($s->getMap('event_queues'));
}
if ($queues) {
foreach ($queues as $queue_name) {
owa_coreAPI::notice("About to prune archive of event queue: {$queue_name}");
$q = owa_coreAPI::getEventQueue($queue_name);
if ($q->connect()) {
$q->pruneArchive($interval);
}
}
}
}
示例2: action
function action()
{
if ($this->getParam('queues')) {
$queues = $this->getParam('queues');
} else {
$queues = 'incoming_tracking_events,processing';
}
owa_coreAPI::notice("About to process event queues: {$queues}");
// pull list of event queues to process from command line
$queues = $this->getParam('queues');
if ($queues) {
// parse command line
$queues = explode(',', $this->getParam('queues'));
} else {
// get whatever queues are registered by modules
$s = owa_coreAPI::serviceSingleton();
$queues = array_keys($s->getMap('event_queues'));
}
if ($queues) {
foreach ($queues as $queue_name) {
$q = owa_coreAPI::getEventQueue($queue_name);
if ($q->connect()) {
$d = owa_coreAPI::getEventDispatch();
$more = true;
while ($more) {
owa_coreAPI::debug('calling receive message');
// get an item from the queue
$event = $q->receiveMessage();
owa_coreAPI::debug('Event returned: ' . print_r($event, true));
if ($event) {
// process event if needed
// lookup which event processor to use to process this event type
$processor_action = owa_coreAPI::getEventProcessor($event->getEventType());
if ($processor_action) {
// processor handles it's own event dispatching, so just return
return owa_coreAPI::handleRequest(array('event' => $event), $processor_action);
} else {
// dispatch event
$ret = $d->notify($event);
}
if ($ret = OWA_EHS_EVENT_HANDLED) {
// delete event from queue
// second param is for backwards compat. remove soon
$q->deleteMessage($event->getQueueGuid());
}
} else {
// if no event, stop the loop
$more = false;
owa_coreAPI::notice("No more events to process.");
}
}
$q->disconnect();
}
}
} else {
owa_coreAPI::notice("There are no event queues registered.");
}
}
示例3: logEvent
/**
* Logs an event to the event queue
*
* take an owa_event object as a message.
*
* @param string $event_type
* @param object $message
* @return boolean
*/
public static function logEvent($event_type, $message = '')
{
// debug
owa_coreAPI::debug("logging event {$event_type}");
if (owa_coreAPI::getSetting('base', 'error_log_level') > 9) {
owa_coreAPI::debug("PHP Server Global: " . print_r($_SERVER, true));
}
// Check to see if named users should be logged
if (owa_coreAPI::getSetting('base', 'log_named_users') != true) {
$cu = owa_coreAPI::getCurrentUser();
$cu_user_id = $cu->getUserData('user_id');
if (!empty($cu_user_id)) {
return false;
}
}
// do not log if the request is robotic
$service = owa_coreAPI::serviceSingleton();
$bcap = $service->getBrowscap();
owa_coreAPI::profile(__CLASS__, __FUNCTION__, __LINE__);
if (!owa_coreAPI::getSetting('base', 'log_robots')) {
if ($bcap->robotCheck()) {
owa_coreAPI::debug("ABORTING: request appears to be from a robot");
owa_coreAPI::setRequestParam('is_robot', true);
return;
}
owa_coreAPI::profile(__CLASS__, __FUNCTION__, __LINE__);
}
// form event if one was not passed
$class = 'owa_event';
if (!$message instanceof $class) {
$event = owa_coreAPI::supportClassFactory('base', 'event');
$event->setProperties($message);
$event->setEventType($event_type);
} else {
$event = $message;
}
// STAGE 1 - set environmental properties from SERVER
$teh = owa_coreAPI::getInstance('owa_trackingEventHelpers', OWA_BASE_CLASS_DIR . 'trackingEventHelpers.php');
$environmentals = $service->getMap('tracking_properties_environmental');
$teh->setTrackerProperties($event, $environmentals);
// Filter XSS exploits from event properties
$event->cleanProperties();
// do not log if the do not log property is set on the event.
if ($event->get('do_not_log')) {
return false;
}
// check to see if IP should be excluded
if (owa_coreAPI::isIpAddressExcluded($event->get('ip_address'))) {
owa_coreAPI::debug("Not logging event. IP address found in exclusion list.");
return false;
}
// queue for later or process event straight away
if (owa_coreAPI::getSetting('base', 'queue_events') || owa_coreAPI::getSetting('base', 'queue_incoming_tracking_events')) {
$q = owa_coreAPI::getEventQueue('incoming_tracking_events');
owa_coreAPI::debug('Queuing ' . $event->getEventType() . ' event with properties: ' . print_r($event->getProperties(), true));
$q->sendMessage($event);
} else {
// lookup which event processor to use to process this event type
$processor_action = owa_coreAPI::getEventProcessor($event->getEventType());
return owa_coreAPI::handleRequest(array('event' => $event), $processor_action);
}
}
示例4: getEventQueue
function getEventQueue($name)
{
return owa_coreAPI::getEventQueue($name);
}
示例5: addToEventQueue
function addToEventQueue()
{
// check to see if IP should be excluded
if (owa_coreAPI::isIpAddressExcluded($this->event->get('ip_address'))) {
owa_coreAPI::debug("Not dispatching event. IP address found in exclusion list.");
return;
}
if (!$this->event->get('do_not_log')) {
//filter event
$this->event = $this->eq->filter('post_processed_tracking_event', $this->event);
// queue for later or notify listeners
if (owa_coreAPI::getSetting('base', 'queue_events') || owa_coreAPI::getSetting('base', 'queue_incoming_tracking_events')) {
$q = owa_coreAPI::getEventQueue('incoming_tracking_events');
owa_coreAPI::debug('Queuing ' . $this->event->getEventType() . ' event with properties: ' . print_r($this->event->getProperties(), true));
$q->sendMessage($this->event);
} else {
owa_coreAPI::debug('Dispatching ' . $this->event->getEventType() . ' event with properties: ' . print_r($this->event->getProperties(), true));
$this->eq->notify($this->event);
}
} else {
owa_coreAPI::debug("Not dispatching event due to 'do not log' flag being set.");
}
}