Skip to content

Commit dee4ac1

Browse files
committed
Add ServiceBus inteface definition
1 parent a22de8e commit dee4ac1

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

azure/functions/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
from ._cosmosdb import Document, DocumentList # NoQA
55
from ._http import HttpResponse # NoQA
66
from ._queue import QueueMessage # NoQA
7+
from ._servicebus import ServiceBusMessage # NoQA

azure/functions/_servicebus.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
2+
import abc
3+
import datetime
4+
import typing
5+
6+
7+
class ServiceBusMessage(abc.ABC):
8+
9+
@abc.abstractmethod
10+
def get_body(self) -> bytes:
11+
"""Return message body as bytes."""
12+
pass
13+
14+
@property
15+
@abc.abstractmethod
16+
def content_type(self) -> typing.Optional[str]:
17+
"""Message content type."""
18+
pass
19+
20+
@property
21+
@abc.abstractmethod
22+
def correlation_id(self) -> typing.Optional[str]:
23+
"""Message correlation identifier."""
24+
pass
25+
26+
@property
27+
@abc.abstractmethod
28+
def expiration_time(self) -> typing.Optional[datetime.datetime]:
29+
"""The date and time in UTC at which the message is set to expire."""
30+
pass
31+
32+
@property
33+
@abc.abstractmethod
34+
def label(self) -> typing.Optional[str]:
35+
"""Application specific label."""
36+
pass
37+
38+
@property
39+
@abc.abstractmethod
40+
def message_id(self) -> str:
41+
"""Identifier used to identify the message."""
42+
pass
43+
44+
@property
45+
@abc.abstractmethod
46+
def partition_key(self) -> typing.Optional[str]:
47+
"""Message partition key."""
48+
pass
49+
50+
@property
51+
@abc.abstractmethod
52+
def reply_to(self) -> typing.Optional[str]:
53+
"""The address of an entity to send replies to."""
54+
pass
55+
56+
@property
57+
@abc.abstractmethod
58+
def reply_to_session_id(self) -> typing.Optional[str]:
59+
"""A session identifier augmenting the reply_to address."""
60+
pass
61+
62+
@property
63+
@abc.abstractmethod
64+
def scheduled_enqueue_time(self) -> typing.Optional[datetime.datetime]:
65+
"""The date and time in UTC at which the message will be enqueued."""
66+
pass
67+
68+
@property
69+
@abc.abstractmethod
70+
def session_id(self) -> typing.Optional[str]:
71+
"""The session identifier for a session-aware entity."""
72+
pass
73+
74+
@property
75+
@abc.abstractmethod
76+
def time_to_live(self) -> typing.Optional[datetime.timedelta]:
77+
"""The TTL time interval."""
78+
pass
79+
80+
@property
81+
@abc.abstractmethod
82+
def to(self) -> typing.Optional[str]:
83+
"""The address of an entity the message is addressed."""
84+
pass
85+
86+
@property
87+
@abc.abstractmethod
88+
def user_properties(self) -> typing.Dict[str, object]:
89+
"""User-defined message metadata."""
90+
pass

0 commit comments

Comments
 (0)