cli_proton_python.sender module

Proton reactive API python sender client

class cli_proton_python.sender.Send(opts)[source]

Bases: cli_proton_python.coreclient.CoreClient

Proton reactive API python sender client

implements various handler methods for reactor events triggered by proton.reactor

on_accepted(event)[source]

called when the remote peer accepts an outgoing message

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

called when the socket is disconnected

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

called when the remote peer rejects an outgoing message

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

called when sending can proceed

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

called when the remote peer has settled the outgoing message, this is the point at which it should never be retransmitted

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

called when the event loop starts, creates a sender for given url

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

next send action scheduler

the Send object itself is shecduled to perform next send action, that is why it contains timer_task method method

incoming event object does not contain many fields, that is why self.event is used

prepare_content()[source]

prepares the content depending on type

Note

  • if self.opts.msg_list_items are set amqp/map content is constructed,
  • elif self.opts.msg_map_items are set amqp/list content is constructed,
  • else the content is considered as text/plain
Returns:string message content
Return type:str (unicode) or list or dict
static prepare_content_from_file(filename)[source]

reads and returns file contents

Parameters:filename (str) – path to file to be opened and read
Returns:contents of filename as unicode string
Return type:str (unicode) or None
prepare_list_content()[source]

prepares list content

Returns:list constructed from options list items
Return type:list
prepare_map_content()[source]

prepares map content

Returns:flat map constructed from options map items
Return type:dict
prepare_message()[source]

compose and return the message

Returns:message to be sent
Return type:proton.Message
prepare_string_content(content)[source]

prepares string content

re-types content accoding content-type given, enables message sequence numbering if formatting string (%[ 0-9]*d) is found

Parameters:content (str (unicode)) – message content string
Returns:string message content
Return type:str (unicode)
send_message()[source]

sends a message

class cli_proton_python.sender.TxSend(opts)[source]

Bases: cli_proton_python.sender.Send, proton.handlers.TransactionHandler

Proton reactive API python transactional sender client

implements various handler methods for reactor events triggered by proton.reactor

on_accepted(event)[source]

suppressed in transactional, no actions are performed

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

suppressed in transactional, no actions are performed

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

suppressed in transactional, no actions are performed

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

suppressed in transactional, no actions are performed

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

called when the event loop starts, creates a transactional sender for given url

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

suppressed in transactional, no actions are performed

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

called when the transaction is aborted

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

called when the transaction is committed

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

called when the transaction is declared

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

finish transaction, do tranaction action, process reporting and control options

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

transactionally send a message, process reporting and control options

Parameters:event (proton.Event) – reactor event
cli_proton_python.sender.main()[source]

main loop