def pack_basic_publish_parameters( exchange_name: ExchangeName, routing_key: RoutingKey, mandatory: bool, immediate: bool, encoding: str) -> bytes: bio = BytesIO() bio.write(RESERVED_SHORT_UINT_DATA) build_shortstr(bio, exchange_name, encoding) build_shortstr(bio, routing_key, encoding) bio.write(pack_booleans(mandatory, immediate)) return bio.getvalue()
def pack_queue_delete_parameters(queue_name: QueueName, if_unused: bool, if_empty: bool, no_wait: bool, encoding: str) -> bytes: bio = BytesIO() bio.write(RESERVED_SHORT_UINT_DATA) build_shortstr(bio, queue_name, encoding) bio.write(pack_booleans(if_unused, if_empty, no_wait)) return bio.getvalue()
def pack_basic_consume_parameters( queue_name: QueueName, consumer_tag: ConsumerTag, no_local: bool, no_ack: bool, exclusive: bool, no_wait: bool, arguments: FieldTable, encoding: str, rabbitmq: bool) -> bytes: bio = BytesIO() bio.write(RESERVED_SHORT_UINT_DATA) build_shortstr(bio, queue_name, encoding) build_shortstr(bio, consumer_tag, encoding) bio.write(pack_booleans(no_local, no_ack, exclusive, no_wait)) build_field_table(bio, arguments, encoding, rabbitmq) return bio.getvalue()
def pack_queue_declare_parameters(queue_name: QueueName, passive: bool, durable: bool, exclusive: bool, auto_delete: bool, no_wait: bool, arguments: FieldTable, encoding: str, rabbitmq: bool) -> bytes: bio = BytesIO() bio.write(RESERVED_SHORT_UINT_DATA) build_shortstr(bio, queue_name, encoding) bio.write(pack_booleans(passive, durable, exclusive, auto_delete, no_wait)) build_field_table(bio, arguments, encoding, rabbitmq) return bio.getvalue()
def pack_exchange_declare_parameters(exchange_name: ExchangeName, type_: ExchangeType, passive: bool, durable: bool, auto_delete: bool, internal: bool, no_wait: bool, arguments: FieldTable, encoding: str, rabbitmq: bool) -> bytes: bio = BytesIO() bio.write(RESERVED_SHORT_UINT_DATA) build_shortstr(bio, exchange_name, encoding) build_shortstr(bio, type_, encoding) bio.write(pack_booleans(passive, durable, auto_delete, internal, no_wait)) build_field_table(bio, arguments, encoding, rabbitmq) return bio.getvalue()
def pack_basic_nack_parameters(delivery_tag: DeliveryTag, multiple: bool, requeue: bool) -> bytes: return pack_long_long_uint(delivery_tag) + pack_booleans(multiple, requeue)