cli_proton_python.coreclient module

Proton reactive API python core client module

exception cli_proton_python.coreclient.ClientException(message)[source]

Bases: exceptions.Exception

custom client exception class (just to know source of exception)

class cli_proton_python.coreclient.CoreClient(opts, reactor_opts=None)[source]

Bases: proton.handlers.MessagingHandler

Proton reactive API python core client

implements various support methods for sender, recevier and connector

static calculate_delay(in_count, in_duration)[source]

calculates delay between sending/receiving messages used by shecduler when requested by duration option (uses logic from deprecated utils.sleep4next)

Parameters:
  • in_count (int) – number of messages to be sent/received
  • in_duration (int) – send/receive process total execution time
Returns:

computed time to wait before or after message is sent/received

Return type:

float

clear_messages()[source]

clears list of stored messages

get_messages()[source]

returns list of stored messages

on_transport_error(event)[source]

handler called when any error related to transport occurs

See also

MessagingHandler::on_transport_error

Parameters:event (proton.Event) – reactor event
parse_connection_options()[source]

Prepare options passed to container connect

Returns:connection options
Return type:dict

Prepare link options passed

Returns:link options
Return type:list
print_message(message)[source]

prints or store a message

utils.print_message wrapper

Parameters:
  • msg (proton.Message) – message
  • msg_format (str) – pre-defined message format
set_delay_after()[source]

returns delay duration after sending a message (in seconds)

Returns:time to wait after message is sent/received
Return type:float
set_delay_before()[source]

returns delay duration before sending a message (in seconds)

Returns:time to wait before message is sent/received
Return type:float
set_up_ssl(event)[source]

sets-up SSLDomain

Parameters:event (proton.Event) – reactor event
set_up_ssl_client_auth(event)[source]

sets-up SSLDomain for the client authentication

Parameters:event (proton.Event) – reactor event
set_up_ssl_server_auth(event)[source]

set-up SSLDomain for the server verification

VERIFY_PEER: Require peer to provide a valid identifying certificate
VERIFY_PEER_NAME: Require valid certificate and matching name
Parameters:event (proton.Event) – reactor event
tear_down(event, settled=False)[source]

tears down and closes the connection

Parameters:
  • event (proton.Event) – reactor event
  • settled (bool) – indicates whether all messages has been explicitly settled
class cli_proton_python.coreclient.CustomBackoff(interval=None, limit=None, timeout=None)[source]

Bases: proton.reactor.Backoff

a reconnect strategy involving an increasing delay between retries, up to a maximum or 60 seconds. This is a modified version supporting limit to the number of reconnect attempts before giving up.

next()[source]

implements the reconnect attempt action

Returns:next reconnect attempt delay time
Return type:float
reset()[source]

resets the reconnect attempts counters

class cli_proton_python.coreclient.DelayedNoop[source]

Bases: object

callback object that does nothing.

on_timer_task(_)[source]

empty event handler method

class cli_proton_python.coreclient.ErrorsHandler(conn_reconnect)[source]

Bases: object

class to be used as universal errors handler for clients

on_unhandled(name, event)[source]

Universal handler which sees all events when added as global handler to reactor.

See also

node_data/clients/python/receiver.py and node_data/clients/python/sender.py

Parameters:
  • name (str) – event name
  • event (proton.Event) – event object