feat: get cient name by connnection info

master
JimZhang 1 year ago
parent 41eb29a282
commit 2ac4e75bc9

@ -6,7 +6,9 @@ import signal
from collections import UserList from collections import UserList
from enum import Enum, auto from enum import Enum, auto
from typing import Callable, Coroutine, Dict, List, Optional from typing import Callable, Coroutine, Dict, List, Optional
from loguru import logger from loguru import logger
from busrtworker.boostrap import RpcBoot from busrtworker.boostrap import RpcBoot
from busrtworker.busrt import OP_PUBLISH, Client, Frame, Rpc, serialize from busrtworker.busrt import OP_PUBLISH, Client, Frame, Rpc, serialize
from busrtworker.kink import di from busrtworker.kink import di
@ -35,6 +37,11 @@ class ConnectionInfo:
bus: Client = self.bus bus: Client = self.bus
await bus.send(topic, Frame(serialize(data) if decode else data, tp=OP_PUBLISH)) await bus.send(topic, Frame(serialize(data) if decode else data, tp=OP_PUBLISH))
def client_name(self):
if not self.bus:
raise ValueError('must be init busrt client could call')
return self.bus.name
class Router: class Router:
table: dict = {} table: dict = {}

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "busrt-worker" name = "busrt-worker"
version = "0.1.2" version = "0.1.3"
description = "busrt-worker is a Python-based async busrt message handle framework" description = "busrt-worker is a Python-based async busrt message handle framework"
authors = ["JimZhang <zzl22100048@gmail.com>"] authors = ["JimZhang <zzl22100048@gmail.com>"]
repository = "https://git.loom.run/Coder/amqp-worker" repository = "https://git.loom.run/Coder/amqp-worker"

Loading…
Cancel
Save