endurox.tpnotify

endurox.tpnotify(clientid: pyclientid, idata: object, flags: int = 0) None

Send unsolicited notification to the client process.

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

tpnotify example
    import sys
    import endurox as e

    class Server:

        def tpsvrinit(self, args):
            e.userlog('Server startup')
            e.tpadvertise('NOTIFSV', 'NOTIFSV', Server.NOTIFSV)
            return 0

        def tpsvrdone(self):
            e.userlog('Server shutdown')

        def NOTIFSV(self, args):
            e.tpnotify(args.cltid, {"data":"HELLO WORLD"}, 0)
            return e.tpreturn(e.TPSUCCESS, 0, {})

    if __name__ == '__main__':
        e.tprun(Server(), sys.argv)
Raises:

AtmiException

Following error codes may be present:
TPEINVAL - Invalid environment or invalid parameters.
TPENOENT - Local process queue does not exist.
TPETIME - Destination queue was blocking and timeout expired.
TPEBLOCK - Destination queue was blocking and TPNOBLOCK was specified.
TPESYSTEM - System error occurred.
TPEOS - Operating system error occurred.

Parameters:
  • clientid (CLIENTID) – Client ID, as received from service call in args.cltid.

  • idata (dict) – ATMI buffer to send.

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