Bloks¶
Blok bus¶
-
class
anyblok_bus.bloks.bus.Bus(registry) Bases:
anyblok.blok.BlokAdd bus configuration in AnyBlok
-
author= 'Suzanne Jean-Sébastien'
-
conditional_by= []
-
conflicting_by= []
-
classmethod
import_declaration_module() Do the python import for the Declaration of the model or other
-
name= 'bus'
-
optional_by= []
-
classmethod
reload_declaration_module(reload)
-
required= ['anyblok-core']
-
required_by= []
-
version= '1.1.0'
-
Memento¶
This blok define two Models:
- Model.Bus.Profile: list the connection available to a rabbitmq server
- Model.Bus.Message: Give the received message witch did not be imported correctly by the consumer
API doc¶
Bus¶
-
class
anyblok_bus.bloks.bus.bus.Bus Bases:
objectNamespace Bus
AnyBlok registration:
- Type: Model
- Registry name: Model.Bus
- Tablename: bus
-
classmethod
get_consumers() Return the list of the consumers
-
classmethod
publish(exchange, routing_key, data, contenttype) Publish a message in an exchange with a routing key through rabbitmq with the profile given by the anyblok configuration
Parameters: - exchange – name of the exchange
- routing_key – name of the routing key
- data – str or unitcode to send through rabbitmq
- contenttype – the mimestype of the data
Exception: PublishException
Profile¶
-
class
anyblok_bus.bloks.bus.profile.Profile Bases:
objectAnyBlok registration:
- Type: Model
- Registry name: Model.Bus.Profile
- Tablename: bus_profile
Fields name Type-anyblok.column.Stringprimary_key-Trueunique-Truenullable-Falsedefault-anyblok.column.NoDefaultValuesize-64
description Type-anyblok.column.Stringdefault-anyblok.column.NoDefaultValuesize-64
url Type-anyblok.column.URLnullable-Falsedefault-anyblok.column.NoDefaultValue
state Type-anyblok.column.Selectionnullable-Falsedefault-'disconnected'size-64
Message¶
-
class
anyblok_bus.bloks.bus.message.Message Bases:
objectAnyBlok registration:
- Type: Model
- Registry name: Model.Bus.Message
- Tablename: bus_message
Fields id Type-anyblok.column.Integerprimary_key-Trueautoincrement-Truedefault-anyblok.column.NoDefaultValue
create_date Type-anyblok.column.DateTimenullable-Falseis auto updated-Falsedefault timezone-<UTC>
edit_date Type-anyblok.column.DateTimenullable-Falseis auto updated-Truedefault timezone-<UTC>
content_type Type-anyblok.column.Stringnullable-Falsedefault-'application/json'size-64
message Type-anyblok.column.LargeBinarynullable-Falsedefault-anyblok.column.NoDefaultValue
sequence Type-anyblok.column.Integernullable-Falsedefault-100
error Type-anyblok.column.Textdefault-anyblok.column.NoDefaultValue
queue Type-anyblok.column.Stringnullable-Falsedefault-anyblok.column.NoDefaultValuesize-64
model Type-anyblok.column.Stringnullable-Falsedefault-anyblok.column.NoDefaultValuesize-64
method Type-anyblok.column.Stringnullable-Falsedefault-anyblok.column.NoDefaultValuesize-64
-
consume() Try to consume on message to import it in database
-
classmethod
consume_all() Try to consume all the message, ordered by the sequence
Exceptions¶
-
exception
anyblok_bus.bloks.bus.exceptions.PublishException Bases:
ExceptionException Error for Publish a message through rabbitmq