Skip to content

Commit

Permalink
Use the new disposition API in python
Browse files Browse the repository at this point in the history
WIP: Split functionality into local and remote disposition as each
have different purposes and access to attributes.

Add python tests

Allow assigning remote dispositions to local delivery
  • Loading branch information
astitcher committed Sep 26, 2024
1 parent 8021693 commit 384ae63
Show file tree
Hide file tree
Showing 4 changed files with 416 additions and 112 deletions.
5 changes: 5 additions & 0 deletions python/cproton.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,19 @@ void pn_disposition_set_section_offset(pn_disposition_t *disposition, uint64_t s
void pn_disposition_set_undeliverable(pn_disposition_t *disposition, _Bool undeliverable);
uint64_t pn_disposition_type(pn_disposition_t *disposition);

typedef struct pn_custom_disposition_t pn_custom_disposition_t;
typedef struct pn_received_disposition_t pn_received_disposition_t;
typedef struct pn_rejected_disposition_t pn_rejected_disposition_t;
typedef struct pn_modified_disposition_t pn_modified_disposition_t;

pn_custom_disposition_t *pn_custom_disposition(pn_disposition_t *disposition);
pn_received_disposition_t *pn_received_disposition(pn_disposition_t *disposition);
pn_rejected_disposition_t *pn_rejected_disposition(pn_disposition_t *disposition);
pn_modified_disposition_t *pn_modified_disposition(pn_disposition_t *disposition);

void pn_custom_disposition_set_type(pn_custom_disposition_t *disposition, uint64_t type);
uint64_t pn_custom_disposition_get_type(pn_custom_disposition_t *disposition);
pn_data_t *pn_custom_disposition_data(pn_custom_disposition_t *disposition);
pn_condition_t *pn_rejected_disposition_condition(pn_rejected_disposition_t *disposition);
uint32_t pn_received_disposition_get_section_number(pn_received_disposition_t *disposition);
void pn_received_disposition_set_section_number(pn_received_disposition_t *disposition, uint32_t section_number);
Expand Down
14 changes: 6 additions & 8 deletions python/proton/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
from ._condition import Condition
from ._data import UNDESCRIBED, Array, Data, Described, char, symbol, timestamp, ubyte, ushort, uint, ulong, \
byte, short, int32, float32, decimal32, decimal64, decimal128, AnnotationDict, PropertyDict, SymbolList
from ._delivery import Delivery, Disposition, DispositionType
from ._delivery import Delivery, Disposition, DispositionType, GeneralDisposition, RejectedDisposition, \
ModifiedDisposition, ReceivedDisposition
from ._endpoints import Endpoint, Connection, Session, Link, Receiver, Sender, Terminus
from ._events import Collector, Event, EventType
from ._exceptions import ProtonException, MessageException, DataException, TransportException, \
Expand All @@ -47,8 +48,6 @@
from ._url import Url

__all__ = [
"API_LANGUAGE",
"IMPLEMENTATION_LANGUAGE",
"UNDESCRIBED",
"AnnotationDict",
"Array",
Expand All @@ -65,16 +64,18 @@
"Endpoint",
"Event",
"EventType",
"GeneralDisposition",
"Handler",
"Link",
"LinkException",
"Message",
"MessageException",
"ModifiedDisposition",
"PropertyDict",
"ProtonException",
"VERSION_MAJOR",
"VERSION_MINOR",
"Receiver",
"ReceivedDisposition",
"RejectedDisposition",
"SASL",
"Sender",
"Session",
Expand Down Expand Up @@ -111,9 +112,6 @@
VERSION_MINOR = PN_VERSION_MINOR
VERSION_POINT = PN_VERSION_POINT
VERSION = (VERSION_MAJOR, VERSION_MINOR, VERSION_POINT)
API_LANGUAGE = "C"
IMPLEMENTATION_LANGUAGE = "C"


handler = logging.NullHandler()

Expand Down
Loading

0 comments on commit 384ae63

Please sign in to comment.