Bloks¶
Blok bus¶
-
class
anyblok_bus.bloks.bus.
Bus
(registry) Bases:
anyblok.blok.Blok
Add 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:
object
Namespace 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:
object
AnyBlok registration:
- Type: Model
- Registry name: Model.Bus.Profile
- Tablename: bus_profile
Fields name Type
-anyblok.column.String
primary_key
-True
unique
-True
nullable
-False
default
-anyblok.column.NoDefaultValue
size
-64
description Type
-anyblok.column.String
default
-anyblok.column.NoDefaultValue
size
-64
url Type
-anyblok.column.URL
nullable
-False
default
-anyblok.column.NoDefaultValue
state Type
-anyblok.column.Selection
nullable
-False
default
-'disconnected'
size
-64
Message¶
-
class
anyblok_bus.bloks.bus.message.
Message
Bases:
object
AnyBlok registration:
- Type: Model
- Registry name: Model.Bus.Message
- Tablename: bus_message
Fields id Type
-anyblok.column.Integer
primary_key
-True
autoincrement
-True
default
-anyblok.column.NoDefaultValue
create_date Type
-anyblok.column.DateTime
nullable
-False
is auto updated
-False
default timezone
-<UTC>
edit_date Type
-anyblok.column.DateTime
nullable
-False
is auto updated
-True
default timezone
-<UTC>
content_type Type
-anyblok.column.String
nullable
-False
default
-'application/json'
size
-64
message Type
-anyblok.column.LargeBinary
nullable
-False
default
-anyblok.column.NoDefaultValue
sequence Type
-anyblok.column.Integer
nullable
-False
default
-100
error Type
-anyblok.column.Text
default
-anyblok.column.NoDefaultValue
queue Type
-anyblok.column.String
nullable
-False
default
-anyblok.column.NoDefaultValue
size
-64
model Type
-anyblok.column.String
nullable
-False
default
-anyblok.column.NoDefaultValue
size
-64
method Type
-anyblok.column.String
nullable
-False
default
-anyblok.column.NoDefaultValue
size
-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:
Exception
Exception Error for Publish a message through rabbitmq