Пример #1
0
def pack_queue_purge_parameters(queue_name: QueueName, no_wait: bool,
                                encoding: str) -> bytes:
    bio = BytesIO()
    bio.write(RESERVED_SHORT_UINT_DATA)
    build_shortstr(bio, queue_name, encoding)
    bio.write(pack_boolean(no_wait))
    return bio.getvalue()
Пример #2
0
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()
Пример #3
0
def pack_connection_open_parameters(virtualhost: VirtualHost,
                                    capabilities: List[str], insist: bool,
                                    encoding: str) -> bytes:
    bio = BytesIO()
    build_shortstr(bio, virtualhost, encoding)
    build_split_shortstr(bio, capabilities, encoding),
    bio.write(pack_boolean(insist))
    return bio.getvalue()
Пример #4
0
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()
Пример #5
0
def pack_connection_start_ok_parameters(client_properties: PeerProperties,
                                        mechanism: str, response: bytes,
                                        locale: str, encoding: str) -> bytes:
    bio = BytesIO()
    build_peer_properties(bio, client_properties, encoding)
    build_shortstr(bio, mechanism, encoding),
    build_binary_longstr(bio, response),
    build_shortstr(bio, locale, encoding)
    return bio.getvalue()
Пример #6
0
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()
Пример #7
0
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()
Пример #8
0
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()
Пример #9
0
def pack_queue_unbind_parameters(queue_name: QueueName,
                                 exchange_name: ExchangeName,
                                 routing_key: RoutingKey,
                                 arguments: FieldTable, encoding: str,
                                 rabbitmq: bool) -> bytes:
    bio = BytesIO()
    bio.write(RESERVED_SHORT_UINT_DATA)
    build_shortstr(bio, queue_name, encoding)
    build_shortstr(bio, exchange_name, encoding)
    build_shortstr(bio, routing_key, encoding)
    build_field_table(bio, arguments, encoding, rabbitmq)
    return bio.getvalue()
Пример #10
0
def pack_exchange_bind_parameters(destination: ExchangeName,
                                  source: ExchangeName,
                                  routing_key: RoutingKey, no_wait: bool,
                                  arguments: FieldTable, encoding: str,
                                  rabbitmq: bool) -> bytes:
    bio = BytesIO()
    bio.write(RESERVED_SHORT_UINT_DATA)
    build_shortstr(bio, destination, encoding)
    build_shortstr(bio, source, encoding)
    build_shortstr(bio, routing_key, encoding)
    bio.write(pack_boolean(no_wait))
    build_field_table(bio, arguments, encoding, rabbitmq)
    return bio.getvalue()
Пример #11
0
def pack_basic_cancel_parameters(consumer_tag: ConsumerTag, no_wait: bool, encoding: str) -> bytes:
    bio = BytesIO()
    build_shortstr(bio, consumer_tag, encoding)
    bio.write(pack_boolean(no_wait))
    return bio.getvalue()