endurox.tpsubscribe

endurox.tpsubscribe(eventexpr: str, filter: str, ctl: endurox.TPEVCTL, flags: int = 0) int

Subscribe to event. Once event is published by the tppost(3), it is delivered to subscribers.

Service name is specified in TPQCTL.name1. TPQCTL.flags must be set to TPEVSERVICE - call service. Flag TPEVPERSIST may be optionally set to not to remove service from event broker in case if service failed. TPQCTL.name2 is reserved for future use.

Service name to which to deliver event notification shall be set in name1 field. Object may be constructed only by the TPEVCTL(flags, name1, name2).

This function applies to ATMI servers only.

For more details see tpsubscribe(3) C API call.

Raises:

AtmiException

Following error codes may be present:
TPEINVAL - Service name empty or too long (longer than MAXTIDENT)
TPELIMIT - More than 48 services attempted to advertise by the script.
TPEMATCH - Service already advertised.
TPEOS - System error.

Parameters:
  • eventexpr (str) – Event expression.

  • filter (str) – Boolean expression for UBF and regexp for STRING buffers to test data before event delivery.

  • ctl (TPEVCTL) – Control structure.

  • flags (int) – Bitwise or’d TPNOTRAN, TPSIGRSTRT, TPNOTIME flags.

Returns:

subscription - subscription id (may be used to unsubscribe)

Return type:

int