Policy event consumer

The Subscriber Policy Charging Manager (SPCM) sends out events that can be consumed by 3rd party applications and APIs. The Policy Event Consumer (PEC) allows these 3rd parties to be notified of events (see Event types) from the SPCM. These events are passed through the PEC via RabbitMQ and onto the external application or api.

An example might be that a particular application wants to know when a PLAN_EXPIRED event type has occured so the application can trigger a notification to offer a plan renewal.

This document (and the PEC) assumes that the SPCM and SPCM exchange are established prior to configuration of the PEC. This is typically configured by Tango Support.

PEC Flow

pec overview customers

PEC Flow
  1. The event comes in through the exchange from the SPCM.

  2. The event enters the event_process queue.

  3. The event is processed and a CDR is written.

  4. If there are no errors, it moves onto the external API.

    1. If there is an error, a CDR is written on the error and it is returned to RabbitMQ and sits in the event_retry queue for the configured amount of time.

You can configure how many retries an event will attempt from the event_retry queue by checking out pec-max-retries in PEC general configuration.
To account for the 3rd party application/api being unavailable, internal configuration is setup that utilizes TTLs and Dead Letter Queues in RabbitMQ that informs the system of unavailability.

Event types

pec event type and json customers

Typically, the SPCM has a set of data types that are produced. Of these data types, events are our primary concern in this context. These events are made available to an external API through the PEC via a JSON payload.

sample request payload - PLAN PURCHASED
{
	"eventType": "PLAN_PURCHASED",
	"subscriber": {
		"msisdn": "35386147258399",
		"imsi" : "4654654646"
	}
	"plan": {
		"id" : "112933,
		"planDefinition" : {
			"name" : "WEEKLY 10GB"
		}
	}
}


You can configure which event types you want consumed by the 3rd party application or API in the [General Configuration] section with the pec.policy-events-include property.

Event Type Table

Event Type Description Included Data Types

SUBSCRIBER_AUTO_PROVISIONED

A new subscriber was autoprovisioned on the system.

Autoprovisioning occurs when an unknown subscriber is provisioned with a plan.
subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

PLAN_PURCHASED

A plan was purchased, provisioned, or added for a subscriber.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


PLAN_CHARGE_FAIL

Charging a plan failed. This can occur for a number of reasons such as insufficient funds or the subscriber being unknown.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


PLAN_CHARGE_ERROR

An error occurred during charging. This happens with system timeouts and communication failures and is not indicative of an error with the subscriber.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


PLAN_ACTIVATION_PENDING

A plan has entered the pending state. Proper activation will occur later on on first data usage, manual activation, or timeout.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


PLAN_ACTIVATED

A plan was activated.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


PLAN_DEACTIVATED

A plan was deactivated.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


PLAN_REACTIVATED

An inactive plan was activated.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


PLAN_DEACTIVATION_TIMEOUT

An inactive plan was reactivated due to a timeout.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


PLAN_TERMINATED

A plan was terminated.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


PLAN_EXPIRY_WARNING

A plan expiry warning threshold has been reached. For example, 1 hour from plan expiry.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


PLAN_EXPIRED

A plan has expired meaning it has reached the end of its current validity.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


PLAN_RECHARGE_FAIL

An attempt to charge for a plan renewal failed.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


PLAN_CANCELLED

A plan has been cancelled meaning it will not renew at the end of the current validity period.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


RULE_VIOLATED

A plan rule has been violated.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates

rule
  • id = the rule ID

  • name = the rule name

  • threshold = the rule’s defined threshold (integer)

  • state = the current state of the rule (active, inactive, violated)


USAGE_CONSUMED

The full plan quota has been consumed.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


USAGE_AVAILABLE

The full plan quota is available again.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

plan
  • id = the unique plan ID

  • planDefinition = the plan definition from which the plan originates


DATA_SESSION_INITIATED

A data session has been initiated.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber

DATA_SESSION_TERMINATED

A data session has been initiated.

subscriber
  • msisdn = the MSISDN of the subscriber

  • imsi = the IMSI of the subscriber