minghuaw / fe2o3-amqp Goto Github PK
View Code? Open in Web Editor NEWA rust implementation of the AMQP1.0 protocol based on serde and tokio.
License: MIT License
A rust implementation of the AMQP1.0 protocol based on serde and tokio.
License: MIT License
Message {
header: Some(Header { durable: true, ..Default::default() }),
delivery_annotations: Some(DeliveryAnnotations::builder().insert("key", 1u32).build()),
message_annotations: Some(MessageAnnotations::builder().insert("key2", "v").build()),
properties: Some(Properties::builder().message_id(1u64).build()),
application_properties: Some(ApplicationProperties::builder().insert("sn", 1i32).build()),
body: Body::Value(AmqpValue(Value::Bool(true))),
footer: None,
}
This will give a deserialization error
Tracking issue recording progress with qpid-interop-test
End of page 49
Note that if the application chooses not to create a terminus, the session endpoint will still create a link endpoint and issue an attach indicating that the link endpoint has no associated local terminus. In this case, the session endpoint MUST immediately detach the newly created link endpoint.
The delivery itself need not be associated with the same transaction as the outcome, or indeed with any transaction at all. However, the delivery MUST NOT be associated with a different non-discharged transaction than the outcome. If this happens then the control link MUST be terminated with a transaction-rollback error
Because the state of the link is controlled by both the sender and receiver, it is impossible to determine the state at the compile time, and thus type state, which only makes sense if state can be known at compile time, doesn't make sense either. Thus the type state will be removed from sender and receiver
The current implementation detects remote detach frame when the Sender
is attempting to send anything. This works fine except when the remote peer is expecting an immediate detach response while the local Sender
is not sending or going to send anything in the near future.
Move handling of the remote detach to Sender
's LinkRelay
?
Overall objective:
TcpListener
SessionListener
should have a life time that is shorter than the life time of the depended connectionLinkListener
should have a life time that is shorter than the life time of the depended sessionThe complex data types for QPID interop test are all defined in JSON format.
Hey,
I wanted to test the library with native-tls or rustls module enabled. Both cause an error while compiling:
error[E0107]: missing generics for struct `ConnectionHandle`
--> /cargo/registry/src/github.com-1ecc6299db9ec823/fe2o3-amqp-0.0.11/src/connection/builder.rs:780:17
|
780 | ) -> Result<ConnectionHandle, OpenError>
| ^^^^^^^^^^^^^^^^ expected 1 generic argument
|
note: struct defined here, with 1 generic parameter: `R`
--> /cargo/registry/src/github.com-1ecc6299db9ec823/fe2o3-amqp-0.0.11/src/connection/mod.rs:55:12
|
55 | pub struct ConnectionHandle<R> {
| ^^^^^^^^^^^^^^^^ -
help: add missing generic argument
|
780 | ) -> Result<ConnectionHandle<R>, OpenError>
| ~~~~~~~~~~~~~~~~~~~
Using Rust 1.60.0
The last bullet point in chapter 2.2 Version Negotiation in the specification says the following:
Note that if the server only supports a single protocol version, it is consistent with the above rules for the server to send its protocol header prior to receiving anything from the client and to subsequently close the socket if the client’s protocol header does not match the server’s.
This is currently not working because in the SASL authorization can read too many bytes from the TcpStream. I'll link a workaround PR which fixed the issue for me but I think it could be handled more elegantly.
How should the flow control be implemented?
The specification says in mode First
The receiver will spontaneously settle all incoming transfers.
This description isn't clear on
go-amqp
In ModeFirst
, the transfers will be Accepted
using acceptIfModeFirst
immediately after the transfer is received. The discussion can be found at here
Originally posted by @minghuaw in #6 (comment)
The receiver type state should require source to be set before it can proceed to attach to a session
SerializeStructVariant
and SerializeTupleVariant
to unimplementedValue
typeThere is currently a big umbrella error type EngineError
that encompasses all the error types, but we clearly should expect the transport, connections, sessions, and links to have different errors. This issue will discuss how to decompose this big umbrella into smaller pieces so that it will become easier to handle properly
Some fields in complex types have default values in spec. The current impl doesn't need Option<_>
wrapper around the field type, which works fine with deserialization. However, this would make the protocol on the wire unnecessarily large on the wire.
If a settled disposition is sent from the receiver, it doesn't remove the entry from its unsettled map. Currently there shouldn't be any public API that allows this, but still it should be fixed.
This will likely be fixed in the upcoming link resumption updated
Some tokio
primitives are not cancellation safe and may lead to loss of data in tokio::select!
. Notify
is one of them. Whether cancellation safety should be taken care of should be investigated.
The following methods are cancellation safe:
tokio::sync::mpsc::Receiver::recv
tokio::sync::mpsc::UnboundedReceiver::recv
tokio::sync::broadcast::Receiver::recv
tokio::sync::watch::Receiver::changed
tokio::net::TcpListener::accept
tokio::net::UnixListener::accept
tokio::signal::unix::Signal::recv
tokio::io::AsyncReadExt::read on any AsyncRead
tokio::io::AsyncReadExt::read_buf on any AsyncRead
tokio::io::AsyncWriteExt::write on any AsyncWrite
tokio::io::AsyncWriteExt::write_buf on any AsyncWrite
tokio_stream::StreamExt::next on any Stream
futures::stream::StreamExt::next on any StreamThe following methods are not cancellation safe and can lead to loss of data:
tokio::io::AsyncReadExt::read_exact
tokio::io::AsyncReadExt::read_to_end
tokio::io::AsyncReadExt::read_to_string
tokio::io::AsyncWriteExt::write_allThe following methods are not cancellation safe because they use a queue for fairness and cancellation makes you lose your place in the queue:
tokio::sync::Mutex::lock
tokio::sync::RwLock::read
tokio::sync::RwLock::write
tokio::sync::Semaphore::acquire
tokio::sync::Notify::notified
Qpid-proton
and amqpnetlite
TcpListener
is implemented in tokioThe receiving endpoint sets its desired filter, the sending endpoint
sets the filter actually in place (including any filters defaulted at the node). The receiving endpoint
MUST check that the filter in place meets its needs and take responsibility for detaching if it does
not.
It is an error for the controller to attempt to discharge a transaction against which a partial delivery has been posted.
How to handle this at the TxnManager
level?
This issue tracks design of transaction manager that handles incoming transactional request (including requests for establishing control links) at the session level. Any input/feedback is welcome.
The specification requires the resource side settle the delivery if the delivery does not come settled.
Delivery Sent Unsettled By Controller; Resource Settles
The resource MUST determine the outcome of the delivery before committing the transaction, and this MUST be communicated to the controller before the acceptance of a successful discharge. The outcome communicated by the resource MUST be associated with the same transaction with which the transfer from controller to resource was associated.
This means the design of resource side transaction should allow user to decide the outcome of a transactional delivery. However, if the incoming transactions are handled the same way as incoming links, the users would have to deal with all the details of taking care of link frames. This also prevents having transactional resources at both the client and listener side of the connection.
The overall objective is to design a trait that can be implemented by external struct to handle incoming transactions while also providing a default implementation.
Multiple values are
represented by the use of an array where the type of the elements in the array is the type defined in the field
definition.
A field which is defined as both multiple and mandatory MUST contain at least one value (i.e. for such a field both
null and an array with no entries are invalid).
The core specification doesn't provide enough details describing exactly what happens when the controller sends a commit/rollback to the resource
Both Azure Service Bus and Huawei Cloud IoTDA requires TLS handshake before SASL handshake.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.