On 18 Oct 2016, at 01:55, James Roper <ja...@lightbend.com> wrote:Hi all,One thing that we've found about microservices architecture is that asynchronous messaging (either p2p or through a broker) needs to become a first class communication mechanism, used just as much, if not more, than REST.
In fact many services deployed in a microservices platform may communicate solely using messaging, and have no REST interface at all. I don't think JMS is up to what microservices demand.
So I'd like to talk about messaging beyond JMS. There are quite a number of different aspects here, so let's see how we go.Higher level abstractionsJMS allows you to work with text or binary messages, plus a few other types, but conceptually, no one actually sends text or binary messages, they send a higher level model objects that are serialized to text or binary. The JMS API could be seen as the HttpServletRequest/Response of messaging, it's a low level API that isn't suitable for high level programming. Just as JAX-RS is the high level API on top of HttpServletRequest/Response that handles the serialization and deserialization of request and response messages (among other things), modern microservice frameworks need to provide a mechanism for transparent handling of serializing and deserializing of messages sent through a message broker or point to point. I think there is a need for a JAX-RS like API for messaging.
An interesting consequence of this that we've found is that the serialization/deserialization technology used needs to have first class, idiomatic support for polymorphic domain objects, because very often the one message stream will have many different types of messages that are sub types of one parent type - we've found this is almost always encountered in messaging, compared to REST where it's relatively more rare.Support for modern messaging brokersOne of the most common message brokers we see in use today with microservices is Kafka, and similar technologies such as AWS Kinesis are also gaining popularity. These differ from many traditional message brokers that map to JMS, in the following ways:* There are no transactions, and definitely no distributed transactions. Transactions are typically used to guarantee exactly once message processing.
These modern message brokers however do not offer exactly once delivery, they offer at least once delivery, which means transactions don't give you anything, even if a publisher ensures that it only publishes each message once, it still could arrive at a consumer twice.
The upshot of this is that what works for messaging handling when using transactions isn't necessarily a good fit for at least once messaging, and APIs may need to be adjusted accordingly.
* Pub-sub is in the control of consumers. In traditional message brokers, you configure pub-sub in the broker, by creating a queue for each consumer, and routing messages appropriately. In Kafka and similar technologies, the consumer is in control here - a consumer can consume any message stream without impacting other consumers, and consumers can form groups that ensure that messages are distributed among the groups. One consequence of this is that you need consumer side APIs for specifying/joining these groups.* Partitioning. These message brokers partition messages for scaling and load balancing, and if you want any ordering guarantees (you usually do), then the producer needs to control how they are partitioned. This is done by the producer extracting a key from messages, and that key is then hashed to a partition.We've found that these concepts need to be first class concepts in the API for successful use in a microservices architecture.Streams integrationSources and sinks for message streams will often be from another API. For example, if using CQRS, very often your source of messages to publish to a broker will be a CQRS read side stream. A microservices messaging solution needs to compatible with different streaming sources and sinks, so that end users don't need to implement their own adapters between these technologies (which can be very difficult to do, especially if they want to implement robust back pressure propagation). Hence, such a messaging API should use a common interface for streaming, and of course Reactive Streams/JDK9 Flows is the prime candidate here.DistributionWhen plumbing streams together from different libraries to a message broker, distribution needs to be considered, and in our experience ends up being a first class concept in the end user APIs. A single service may consist of many nodes, publishing the stream from every node is not usually desirable since that means each message will be published once for each node doing the publishing. Sometimes you want a singleton node doing the publishing, sometimes if the source stream is sharded, you want to distribute the shards out across the cluster so that the publishing load is shared by all nodes in the service. We've found that end user APIs need to give the user control over this in order to implement it successfully.So, I've said a lot here, I'm interested in whether people agree with my assessment or not.
--
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CABY0rKP6J_RoVQ%2Br4DRXvGiUVwQHB7FiUXF7ROdFEOO%2BMy_LPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Hi James.Thanks for kicking this one off. It’s related to an action item I had coming off the back of the JavaOne BOF we did, which I hadn’t gotten around to yet so it’s well timed too. Just for completeness, and before I jump into some of your text, I’d said I would kick off a discussion about supporting binary protocols for communication that go beyond HTTP/2. The reason for this is that despite the fact I understand why REST/HTTP (or more typically just HTTP) is the preferred way in which people talk about communication between microservices, it has its limitations and one of which is performance. As microservices push us (back) towards distributed systems, and they become chattier, the performance of whatever protocol they use becomes an important consideration and whilst HTTP is a convenient approach, it’s not something I believe many of Red Hat’s customers will want to use to the exclusion of all else. And this probably goes to the heart of my response here: I don’t believe one size fits all in general and definitely not with distributed communications. So whilst I expect REST/HTTP and JMS to be something some microservices will want to use, I’m sure there will be other implementations in play as well.On 18 Oct 2016, at 01:55, James Roper <ja...@lightbend.com> wrote:Hi all,One thing that we've found about microservices architecture is that asynchronous messaging (either p2p or through a broker) needs to become a first class communication mechanism, used just as much, if not more, than REST.I agree though I’d be cautious about using the term REST, which is why I called out REST/HTTP and HTTP. I suspect you mean REST/HTTP here rather than just REST because whilst the latter is an architectural approach which doesn’t imply synchronous or asynchronous behaviour, the former is a specific implementation of that architecture (which again does support asynchronous behaviour).
In fact many services deployed in a microservices platform may communicate solely using messaging, and have no REST interface at all. I don't think JMS is up to what microservices demand.I disagree and yet I would agree if the statement was “I don’t think JMS is up to what all microservices demand”.So I'd like to talk about messaging beyond JMS. There are quite a number of different aspects here, so let's see how we go.Higher level abstractionsJMS allows you to work with text or binary messages, plus a few other types, but conceptually, no one actually sends text or binary messages, they send a higher level model objects that are serialized to text or binary. The JMS API could be seen as the HttpServletRequest/Response of messaging, it's a low level API that isn't suitable for high level programming. Just as JAX-RS is the high level API on top of HttpServletRequest/Response that handles the serialization and deserialization of request and response messages (among other things), modern microservice frameworks need to provide a mechanism for transparent handling of serializing and deserializing of messages sent through a message broker or point to point. I think there is a need for a JAX-RS like API for messaging.We tried it in the early 2000’s and the result was the ESB :) Most successful ESBs started with an abstraction for messaging (synchronous and/or asynchronous). Ignoring the JBI standard which came out of the JCP during that time, there really hasn’t been a lot of effort to standardise this and I’m not sure if that’s because of lack of interest or because SOAP came along and people got confused between that and what ESBs were attempting to do (ESB != SOAP but if you ask people these days many of them seem to believe they are equivalent.)Perhaps a more tractable option isn’t to try to create an API for all messaging approaches but just one(s) that are sufficiently different from JMS or others that already have a suitable standard?An interesting consequence of this that we've found is that the serialization/deserialization technology used needs to have first class, idiomatic support for polymorphic domain objects, because very often the one message stream will have many different types of messages that are sub types of one parent type - we've found this is almost always encountered in messaging, compared to REST where it's relatively more rare.Support for modern messaging brokersOne of the most common message brokers we see in use today with microservices is Kafka, and similar technologies such as AWS Kinesis are also gaining popularity. These differ from many traditional message brokers that map to JMS, in the following ways:* There are no transactions, and definitely no distributed transactions. Transactions are typically used to guarantee exactly once message processing.Whilst they can be used for that, I certainly wouldn’t say that’s their typical use case. Well, at least not what I’ve observed over the last 30+ years.These modern message brokers however do not offer exactly once delivery, they offer at least once delivery, which means transactions don't give you anything, even if a publisher ensures that it only publishes each message once, it still could arrive at a consumer twice.I wouldn’t mix transactions into this discussion just yet without at least defining what you mean by a transaction. Again I assume you mean an ACID transaction or perhaps being even more specific and XA?
The upshot of this is that what works for messaging handling when using transactions isn't necessarily a good fit for at least once messaging, and APIs may need to be adjusted accordingly.I agree that changes will likely be needed at a number of levels, including the types of transactions to be supported, if any :)
* Pub-sub is in the control of consumers. In traditional message brokers, you configure pub-sub in the broker, by creating a queue for each consumer, and routing messages appropriately. In Kafka and similar technologies, the consumer is in control here - a consumer can consume any message stream without impacting other consumers, and consumers can form groups that ensure that messages are distributed among the groups. One consequence of this is that you need consumer side APIs for specifying/joining these groups.* Partitioning. These message brokers partition messages for scaling and load balancing, and if you want any ordering guarantees (you usually do), then the producer needs to control how they are partitioned. This is done by the producer extracting a key from messages, and that key is then hashed to a partition.We've found that these concepts need to be first class concepts in the API for successful use in a microservices architecture.Streams integrationSources and sinks for message streams will often be from another API. For example, if using CQRS, very often your source of messages to publish to a broker will be a CQRS read side stream. A microservices messaging solution needs to compatible with different streaming sources and sinks, so that end users don't need to implement their own adapters between these technologies (which can be very difficult to do, especially if they want to implement robust back pressure propagation). Hence, such a messaging API should use a common interface for streaming, and of course Reactive Streams/JDK9 Flows is the prime candidate here.DistributionWhen plumbing streams together from different libraries to a message broker, distribution needs to be considered, and in our experience ends up being a first class concept in the end user APIs. A single service may consist of many nodes, publishing the stream from every node is not usually desirable since that means each message will be published once for each node doing the publishing. Sometimes you want a singleton node doing the publishing, sometimes if the source stream is sharded, you want to distribute the shards out across the cluster so that the publishing load is shared by all nodes in the service. We've found that end user APIs need to give the user control over this in order to implement it successfully.So, I've said a lot here, I'm interested in whether people agree with my assessment or not.I’ll encourage Red Hat’s messaging team to jump in here too and try to give a more detailed response. It would be good to start with a specific use case and grow the discussion around that. We’ve also got our conference application which we’re using to try to demonstrate these use cases so perhaps think about how that might be changed to accommodate?Mark.
--
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CABY0rKP6J_RoVQ%2Br4DRXvGiUVwQHB7FiUXF7ROdFEOO%2BMy_LPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
On 18 Oct 2016, at 23:47, John D. Ament <john.d...@gmail.com> wrote:I take the JMS argument a bit passionately, and am currently not happy with Oracle's decision.
It seems like JMS is misunderstood
- which is ironic as I don't think I had as good of an understanding of it 6 years ago when I first worked on a JMS related project w/ JBoss guys.JMS is purely a client API. It defines some expectations for message headers and features of brokers, but that's it. It doesn't require protocols, or interactions, or clustering. It's simply "you must support P2P and PubSub via this client API." By not tying in a protocol, it makes leveraging components such as Amazon SQS pretty straight forward (and for what its worth - Amazon SQS does have a JMS client library). The JMS 1.x team built an API that was customary for its point in time. Back then, you dealt a lot with resources, manually opening and closing things, and heavy-weight transactions on the container. You didn't deal with fluent APIs. Which is all stuff that changed in JMS 2.0.Messaging is pretty critical to cloud based applications. Streaming events is simply a derived design paradigm from the decoupled messaging. Its often implemented on top of AMQP brokers. Likewise, the entire IoT movement is powered by MQTT. Real time communication in these devices is not possible, but asynchronous polling and pushing? Great idea. Even when it comes to publishing cluster state. Its smarter to publish to a topic than it is to have all the clients poll for data in a database table.
On Monday, October 17, 2016 at 8:55:30 PM UTC-4, James Roper wrote:Hi all,One thing that we've found about microservices architecture is that asynchronous messaging (either p2p or through a broker) needs to become a first class communication mechanism, used just as much, if not more, than REST. In fact many services deployed in a microservices platform may communicate solely using messaging, and have no REST interface at all. I don't think JMS is up to what microservices demand. So I'd like to talk about messaging beyond JMS. There are quite a number of different aspects here, so let's see how we go.Higher level abstractionsJMS allows you to work with text or binary messages, plus a few other types, but conceptually, no one actually sends text or binary messages, they send a higher level model objects that are serialized to text or binary. The JMS API could be seen as the HttpServletRequest/Response of messaging, it's a low level API that isn't suitable for high level programming. Just as JAX-RS is the high level API on top of HttpServletRequest/Response that handles the serialization and deserialization of request and response messages (among other things), modern microservice frameworks need to provide a mechanism for transparent handling of serializing and deserializing of messages sent through a message broker or point to point. I think there is a need for a JAX-RS like API for messaging.An interesting consequence of this that we've found is that the serialization/deserialization technology used needs to have first class, idiomatic support for polymorphic domain objects, because very often the one message stream will have many different types of messages that are sub types of one parent type - we've found this is almost always encountered in messaging, compared to REST where it's relatively more rare.Support for modern messaging brokersOne of the most common message brokers we see in use today with microservices is Kafka, and similar technologies such as AWS Kinesis are also gaining popularity. These differ from many traditional message brokers that map to JMS, in the following ways:* There are no transactions, and definitely no distributed transactions. Transactions are typically used to guarantee exactly once message processing. These modern message brokers however do not offer exactly once delivery, they offer at least once delivery, which means transactions don't give you anything, even if a publisher ensures that it only publishes each message once, it still could arrive at a consumer twice. The upshot of this is that what works for messaging handling when using transactions isn't necessarily a good fit for at least once messaging, and APIs may need to be adjusted accordingly.* Pub-sub is in the control of consumers. In traditional message brokers, you configure pub-sub in the broker, by creating a queue for each consumer, and routing messages appropriately. In Kafka and similar technologies, the consumer is in control here - a consumer can consume any message stream without impacting other consumers, and consumers can form groups that ensure that messages are distributed among the groups. One consequence of this is that you need consumer side APIs for specifying/joining these groups.* Partitioning. These message brokers partition messages for scaling and load balancing, and if you want any ordering guarantees (you usually do), then the producer needs to control how they are partitioned. This is done by the producer extracting a key from messages, and that key is then hashed to a partition.We've found that these concepts need to be first class concepts in the API for successful use in a microservices architecture.Streams integrationSources and sinks for message streams will often be from another API. For example, if using CQRS, very often your source of messages to publish to a broker will be a CQRS read side stream. A microservices messaging solution needs to compatible with different streaming sources and sinks, so that end users don't need to implement their own adapters between these technologies (which can be very difficult to do, especially if they want to implement robust back pressure propagation). Hence, such a messaging API should use a common interface for streaming, and of course Reactive Streams/JDK9 Flows is the prime candidate here.DistributionWhen plumbing streams together from different libraries to a message broker, distribution needs to be considered, and in our experience ends up being a first class concept in the end user APIs. A single service may consist of many nodes, publishing the stream from every node is not usually desirable since that means each message will be published once for each node doing the publishing. Sometimes you want a singleton node doing the publishing, sometimes if the source stream is sharded, you want to distribute the shards out across the cluster so that the publishing load is shared by all nodes in the service. We've found that end user APIs need to give the user control over this in order to implement it successfully.So, I've said a lot here, I'm interested in whether people agree with my assessment or not.--
--
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/7cfebbfa-eccf-45a6-9ab5-2515fd85edf2%40googlegroups.com.
On 19 Oct 2016, at 02:22, James Roper <ja...@lightbend.com> wrote:On 18 Oct 2016, at 01:55, James Roper <ja...@lightbend.com> wrote:Hi all,One thing that we've found about microservices architecture is that asynchronous messaging (either p2p or through a broker) needs to become a first class communication mechanism, used just as much, if not more, than REST.I agree though I’d be cautious about using the term REST, which is why I called out REST/HTTP and HTTP. I suspect you mean REST/HTTP here rather than just REST because whilst the latter is an architectural approach which doesn’t imply synchronous or asynchronous behaviour, the former is a specific implementation of that architecture (which again does support asynchronous behaviour).Actually the term I should have used is JAX-RS (or JAX-WS), this is the status quo for communication between services coming from a Java EE world, is it not?
These modern message brokers however do not offer exactly once delivery, they offer at least once delivery, which means transactions don't give you anything, even if a publisher ensures that it only publishes each message once, it still could arrive at a consumer twice.I wouldn’t mix transactions into this discussion just yet without at least defining what you mean by a transaction. Again I assume you mean an ACID transaction or perhaps being even more specific and XA?When it comes to transactions on a messaging provider, it's mostly just the message is consumed or it isn't - perhaps if you want to maintain ordering while eagerly processing multiple messages at once, you may have some more complex transaction logic where one message failing causes all subsequent messages to rollback, but generally in my experience it's been primarily about a message either being consumed or not.
In that context, it's mostly XA that I'm referring to, having whether the message is consumed or not being connected to whether the database transaction associated with the message processing is committed or not. Failure to tie these two transactions together results in at least once guarantees instead of exactly once guarantees processing if you send the message inside the database transaction and confirm receipt of the message outside of the receiving end transaction, or will result in at most once guarantees instead of exactly once if you send the message outside of the sending side database transaction or confirm receipt inside/before the database transaction on the receiving side. So my argument is that if the message provider only gives you at least once messaging guarantees in the first place, then there's no need for XA transactions between the message provider and the database, as you can already achieve at least once guarantees without them, and you can't improve on at least once if all the message broker offers is at least once.
Hi all,One thing that we've found about microservices architecture is that asynchronous messaging (either p2p or through a broker) needs to become a first class communication mechanism, used just as much, if not more, than REST. In fact many services deployed in a microservices platform may communicate solely using messaging, and have no REST interface at all. I don't think JMS is up to what microservices demand. So I'd like to talk about messaging beyond JMS. There are quite a number of different aspects here, so let's see how we go.Higher level abstractionsJMS allows you to work with text or binary messages, plus a few other types, but conceptually, no one actually sends text or binary messages, they send a higher level model objects that are serialized to text or binary. The JMS API could be seen as the HttpServletRequest/Response of messaging, it's a low level API that isn't suitable for high level programming. Just as JAX-RS is the high level API on top of HttpServletRequest/Response that handles the serialization and deserialization of request and response messages (among other things), modern microservice frameworks need to provide a mechanism for transparent handling of serializing and deserializing of messages sent through a message broker or point to point. I think there is a need for a JAX-RS like API for messaging.An interesting consequence of this that we've found is that the serialization/deserialization technology used needs to have first class, idiomatic support for polymorphic domain objects, because very often the one message stream will have many different types of messages that are sub types of one parent type - we've found this is almost always encountered in messaging, compared to REST where it's relatively more rare.
Support for modern messaging brokersOne of the most common message brokers we see in use today with microservices is Kafka, and similar technologies such as AWS Kinesis are also gaining popularity. These differ from many traditional message brokers that map to JMS, in the following ways:* There are no transactions, and definitely no distributed transactions. Transactions are typically used to guarantee exactly once message processing. These modern message brokers however do not offer exactly once delivery, they offer at least once delivery, which means transactions don't give you anything, even if a publisher ensures that it only publishes each message once, it still could arrive at a consumer twice. The upshot of this is that what works for messaging handling when using transactions isn't necessarily a good fit for at least once messaging, and APIs may need to be adjusted accordingly.* Pub-sub is in the control of consumers. In traditional message brokers, you configure pub-sub in the broker, by creating a queue for each consumer, and routing messages appropriately. In Kafka and similar technologies, the consumer is in control here - a consumer can consume any message stream without impacting other consumers, and consumers can form groups that ensure that messages are distributed among the groups. One consequence of this is that you need consumer side APIs for specifying/joining these groups.* Partitioning. These message brokers partition messages for scaling and load balancing, and if you want any ordering guarantees (you usually do), then the producer needs to control how they are partitioned. This is done by the producer extracting a key from messages, and that key is then hashed to a partition.We've found that these concepts need to be first class concepts in the API for successful use in a microservices architecture.
Streams integrationSources and sinks for message streams will often be from another API. For example, if using CQRS, very often your source of messages to publish to a broker will be a CQRS read side stream. A microservices messaging solution needs to compatible with different streaming sources and sinks, so that end users don't need to implement their own adapters between these technologies (which can be very difficult to do, especially if they want to implement robust back pressure propagation). Hence, such a messaging API should use a common interface for streaming, and of course Reactive Streams/JDK9 Flows is the prime candidate here.
--
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/ada1b636-0b73-4e39-97db-f1539f2d028c%40googlegroups.com.
I really like the idea of the Reactive Streams. it's an API easy
enough to be implemented.
I am still trying to understand how your API would glue together with Streams
Some questions I have:
- I see that you have the intent of introducing the concept of ACKs to
the API (the commit)?
- Partition would be translated to a node on a cluster of brokers?
What is a partition in concrete terms (thinking on a message broker
case).
- MessageOffset? What is the use? to start a subscribe like Kafka case
for N Messages? wouldn't that be too much at the implementation level,
other providers could have different means of starting or Resuming a
Flow / Subscriber?
This caught my personal interest. I really want to build from there on this.
On Thu, Nov 3, 2016 at 6:48 AM, James Roper <ja...@lightbend.com> wrote:
> Hi all,
>
> To follow up on this with something more concrete of what we've been
> thinking, we've created a discussion starter API that sums up how we think
> messaging should be handled in microservices. Note this isn't a proposal,
> we are not married to anything in this API, it's simply something to trigger
> some discussion.
>
> A big difference between this and JMS is JMS handles one message at a time,
> where this API deals with streams of messages. The README in the repo
> describes the design goals and principles, as well as explains how we came
> up with this API, and gives some pointers of where to start looking at it.
>
> https://github.com/jroper/java-messaging
>
> Cheers,
>
> James
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "MicroProfile" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> To post to this group, send email to microp...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/microprofile/ada1b636-0b73-4e39-97db-f1539f2d028c%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
--
Clebert Suconic
I know the commit here doesn't mean transaction (it's a
way to ack receive), but my concern (im not sure it's valid) is with
transactions.
the moment you introduce something for acks, users will want different
ack means, batched, Auto-Ack, XA...
what about sending?
What is the general direction on transactions for the microprofile? I
have heard it's everything simplified, so I need to do some research
of my own? so if that's the case my concern is not valid.
>> > To post to this group, send email to microp...@googlegroups.com.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/microprofile/ada1b636-0b73-4e39-97db-f1539f2d028c%40googlegroups.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Clebert Suconic
>
>
>
>
> --
> James Roper
> Software Engineer
>
> Lightbend – Build reactive apps!
> Twitter: @jroper
--
Clebert Suconic
>> > To post to this group, send email to microp...@googlegroups.com.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/microprofile/ada1b636-0b73-4e39-97db-f1539f2d028c%40googlegroups.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Clebert Suconic
>
>
>
>
> --
> James Roper
> Software Engineer
>
> Lightbend – Build reactive apps!
> Twitter: @jroper
--
Clebert Suconic
Hi,
I've been reading this thread and learning about the technologies in MicroProfile 1.0 and I agree that a messaging API at the abstraction level of JAX-RS is a good idea. I'm happy to get involved in working on this.
I agree with a lot of the principles in the thread too. They match modern messaging systems and use cases nicely. I think the important ones are:
I think the contentious one is the last one. Distributed messaging systems like Apache Kafka and Amazon SQS prioritise availability over consistency. They can't really do exactly-once publish, acknowledgement or delivery (that's a simplification for Kafka, but approximately true). So, I think it would be better to set an expectation of at-least-once delivery to start with. If you have at-least-once delivery, you might get duplication in error situations and consuming a message inside a transaction isn't going to prevent that. You're going to need idempotent processing either way.
Thanks,
Andrew Schofield
Event Services, IBM Watson and Cloud Platform
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CAKF%2Bbso8AEv1VpXy0wKOcpzS3rr-_m-ctH8U_4Sktbe%2Br68vXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
On 30 November 2016 at 07:15, Clebert Suconic <clebert...@gmail.com> wrote:> No transactions or exactly-once delivery - smart endpoints and dumb pipes
I agree with no transactions as part of the API. although we all have
our users, and some of them care about distributed transactions, e.g.
Financial institutions.
But perhaps the idea is to implement these things transparently
without the user realizing it's going XA behind the scenes.I think this would be possible to do. Though if a user came to me saying they need XA, then I'd tell them that they aren't ready for microservices and should stick to Java EE - if they're not willing to change their architectural approach, then they shouldn't force themselves to change their architectural approach by switching to microservices.
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CAKF%2Bbso8AEv1VpXy0wKOcpzS3rr-_m-ctH8U_4Sktbe%2Br68vXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/b70b2980-ad2a-4c8f-b1f1-09cd01a6ac80%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CABY0rKNOHkP5EMvx6K7b6yQsu1xWgpbKvYvZAdB13DP85EPy3g%40mail.gmail.com.
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CABY0rKMTKy8KDT-G_4W11oaHVBuJnDc%2BjDo6jQMWXyWs8dv8yA%40mail.gmail.com.
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CABY0rKMTKy8KDT-G_4W11oaHVBuJnDc%2BjDo6jQMWXyWs8dv8yA%40mail.gmail.com.
My main question then is where to next. The API proposal I put together is very rough, it was about 2 hours of thought taking some of the ideas that we've been introducing in Lagom, but trying to apply it to something that is less opinionated than Lagom (Lagom is by design incredibly opinionated, it's messaging API at least is not likely a suitable candidate for a standardisation effort). So my main question is should we use that as a start and work from there, or should we start from scratch? Or is it too early to work at the concrete level of APIs? Is there a process that the microprofile effort in general is adopting for things like this?One possibility is that we come up with a use case for messaging in the microprofile example app, and do a rough API with a limited implementation that just demonstrates the feature. I'm not sure where we'd start with that, if that's something that would be worthwhile doing I'd appreciate any help or guidance that anyone can offer.Regards,James
On 30 November 2016 at 10:56, Erin Schnabel <erinsc...@gmail.com> wrote:
Strongly agree with all points. Especially the last: No transactions or exactly-once guarantee.
On Tuesday, November 29, 2016 at 12:21:04 PM UTC-5, andrew_s...@uk.ibm.com wrote:Hi,
I've been reading this thread and learning about the technologies in MicroProfile 1.0 and I agree that a messaging API at the abstraction level of JAX-RS is a good idea. I'm happy to get involved in working on this.
I agree with a lot of the principles in the thread too. They match modern messaging systems and use cases nicely. I think the important ones are:
- API not tied to a specific messaging system - I should be able to implement on top of whatever messaging system I like within reason
- Much simpler API than JMS - easier to learn, cheaper to implement
- Topic-based publish/subscribe - with a way of sharing messages on a subscription
- Message ordering - could be partitioning, but I think the important thing is a key
- Interoperability with non-Java code - so I can use MicroProfile to implement the Java parts of a multi-language environment
- No transactions or exactly-once delivery - smart endpoints and dumb pipes
I think the contentious one is the last one. Distributed messaging systems like Apache Kafka and Amazon SQS prioritise availability over consistency. They can't really do exactly-once publish, acknowledgement or delivery (that's a simplification for Kafka, but approximately true). So, I think it would be better to set an expectation of at-least-once delivery to start with. If you have at-least-once delivery, you might get duplication in error situations and consuming a message inside a transaction isn't going to prevent that. You're going to need idempotent processing either way.
Thanks,
Andrew Schofield
Event Services, IBM Watson and Cloud Platform
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/b70b2980-ad2a-4c8f-b1f1-09cd01a6ac80%40googlegroups.com.
@Inject
@Outbound
Event<CustomMessage> event;
To send the event you then just use the standard CDI api;CustomMessage message = new CustomMessage ( 'test', 'server-1');
event.fire(message);
public void observe(@Observes @Inbound CustomMessage event) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "MessageReceiverBean Received Event {0}", event);
}Great discussion! I agree that the JMS API is misunderstood/demonized. In my 15+ years of working with distributed computing and messaging, I continue to be surprised by how often a messaging edge case is already handled by the JMS API. I agree the “Kafka-like” use case isn’t there currently, but if you break down the Kakfa use case I see a new delivery mode and a subscription strategy/consumer-type as the big gaps.
With Oracle breaking from the JMS API, are there options for the community to do a community-driven JMS 3.0? I haven’t found a mention of a trademark anywhere. Maybe it needs a new name just to rebrand? I think it would be great to strive for something that is earmarked for JCP-like inclusion (not suggesting this should be Java-only) and avoid the “API-defined-outside-and-then-gets-standardized-into-the-JDK” multi-year lag that was REST/JAX-RS. I think the JMS 2.0 API provides that “slim” mode, and would is good input to requirements. There are still use cases where having the connection-session-producer/consumer model for those that need advanced handling and shared-object handling use cases (connection pooling, large number of destinations, small message size, small message volume).
Thoughts:
1. I think a messaging API should strive to meet all messaging use cases. While the “kafka”-style messaging model is the-new-cool-thing, it also is just one of many messaging use cases. Using the current JMS feature set as a baseline of requirements ensures a number of use cases that have been used in distributed computing over the past 20+ years are covered.
2. I think not matching the API with at least one reference wire-protocol was a big miss by JMS v1.x and should be considered.
3. A fair way to look at transactions is that it reduces the surface area of potential data loss or undesirable behavior during unplanned outage. While it won’t ever by 100% correct (b/c distributed computing), transactions provide non-zero value to many use cases.
4. The “Kafka” consumer use case is essential consumer-driven vs broker-driven when it comes to marking state of the subscription. I think this could be handled with the addition of a destination + selector syntax. In current JMS it would look like: session.createMarkedConsumer(destination, marker) where “marker” could follow the selector syntax. This would allow consumers to use message id, header key+value, or other query to tell the broker where to start up again.
5. As far as “Kafka”-style partitioning, I’m curious why folks insist on a single destination? Message Groups / Affinity Groups already exist in most brokers for doing same-queue partitioning. Server side, brokers can be configured to split storage of destinations across multiple storage volumes to scale disk I/O. At some point in Distributed Computing, you reach a CPU/Network/Storage limit and need to partition to a separate queue and then on to a separate host. This all seems server-side-ish and not sure there should be anything API specific, maybe wire protocol handling for rebalancing or redirecting of publishers? Maybe making the JMSXGoupId/JMSXSeqId-like option more of a first-class citizen?
6. The Kafka-style producing use-case is essentially async send and a non-sync() store to disk. Most brokers and clients can be configured to this already. Maybe a new DeliveryMode to call it out as a first class option? Something akin to: NON-PERSISTENT, PERSISTENT and LAZY_PERSISTENT?
Hi all,One thing that we've found about microservices architecture is that asynchronous messaging (either p2p or through a broker) needs to become a first class communication mechanism, used just as much, if not more, than REST. In fact many services deployed in a microservices platform may communicate solely using messaging, and have no REST interface at all. I don't think JMS is up to what microservices demand. So I'd like to talk about messaging beyond JMS. There are quite a number of different aspects here, so let's see how we go.Higher level abstractionsJMS allows you to work with text or binary messages, plus a few other types, but conceptually, no one actually sends text or binary messages, they send a higher level model objects that are serialized to text or binary. The JMS API could be seen as the HttpServletRequest/Response of messaging, it's a low level API that isn't suitable for high level programming. Just as JAX-RS is the high level API on top of HttpServletRequest/Response that handles the serialization and deserialization of request and response messages (among other things), modern microservice frameworks need to provide a mechanism for transparent handling of serializing and deserializing of messages sent through a message broker or point to point. I think there is a need for a JAX-RS like API for messaging.
An interesting consequence of this that we've found is that the serialization/deserialization technology used needs to have first class, idiomatic support for polymorphic domain objects, because very often the one message stream will have many different types of messages that are sub types of one parent type - we've found this is almost always encountered in messaging, compared to REST where it's relatively more rare.
Support for modern messaging brokers
One of the most common message brokers we see in use today with microservices is Kafka, and similar technologies such as AWS Kinesis are also gaining popularity. These differ from many traditional message brokers that map to JMS, in the following ways:* There are no transactions, and definitely no distributed transactions. Transactions are typically used to guarantee exactly once message processing. These modern message brokers however do not offer exactly once delivery, they offer at least once delivery, which means transactions don't give you anything, even if a publisher ensures that it only publishes each message once, it still could arrive at a consumer twice. The upshot of this is that what works for messaging handling when using transactions isn't necessarily a good fit for at least once messaging, and APIs may need to be adjusted accordingly.* Pub-sub is in the control of consumers. In traditional message brokers, you configure pub-sub in the broker, by creating a queue for each consumer, and routing messages appropriately. In Kafka and similar technologies, the consumer is in control here - a consumer can consume any message stream without impacting other consumers, and consumers can form groups that ensure that messages are distributed among the groups. One consequence of this is that you need consumer side APIs for specifying/joining these groups.* Partitioning. These message brokers partition messages for scaling and load balancing, and if you want any ordering guarantees (you usually do), then the producer needs to control how they are partitioned. This is done by the producer extracting a key from messages, and that key is then hashed to a partition.We've found that these concepts need to be first class concepts in the API for successful use in a microservices architecture.
Streams integrationSources and sinks for message streams will often be from another API. For example, if using CQRS, very often your source of messages to publish to a broker will be a CQRS read side stream. A microservices messaging solution needs to compatible with different streaming sources and sinks, so that end users don't need to implement their own adapters between these technologies (which can be very difficult to do, especially if they want to implement robust back pressure propagation). Hence, such a messaging API should use a common interface for streaming, and of course Reactive Streams/JDK9 Flows is the prime candidate here.
DistributionWhen plumbing streams together from different libraries to a message broker, distribution needs to be considered, and in our experience ends up being a first class concept in the end user APIs. A single service may consist of many nodes, publishing the stream from every node is not usually desirable since that means each message will be published once for each node doing the publishing. Sometimes you want a singleton node doing the publishing, sometimes if the source stream is sharded, you want to distribute the shards out across the cluster so that the publishing load is shared by all nodes in the service. We've found that end user APIs need to give the user control over this in order to implement it successfully.So, I've said a lot here, I'm interested in whether people agree with my assessment or not.
Hi all,One thing that we've found about microservices architecture is that asynchronous messaging (either p2p or through a broker) needs to become a first class communication mechanism, used just as much, if not more, than REST. In fact many services deployed in a microservices platform may communicate solely using messaging, and have no REST interface at all. I don't think JMS is up to what microservices demand. So I'd like to talk about messaging beyond JMS. There are quite a number of different aspects here, so let's see how we go.Higher level abstractionsJMS allows you to work with text or binary messages, plus a few other types, but conceptually, no one actually sends text or binary messages, they send a higher level model objects that are serialized to text or binary. The JMS API could be seen as the HttpServletRequest/Response of messaging, it's a low level API that isn't suitable for high level programming. Just as JAX-RS is the high level API on top of HttpServletRequest/Response that handles the serialization and deserialization of request and response messages (among other things), modern microservice frameworks need to provide a mechanism for transparent handling of serializing and deserializing of messages sent through a message broker or point to point. I think there is a need for a JAX-RS like API for messaging.An interesting consequence of this that we've found is that the serialization/deserialization technology used needs to have first class, idiomatic support for polymorphic domain objects, because very often the one message stream will have many different types of messages that are sub types of one parent type - we've found this is almost always encountered in messaging, compared to REST where it's relatively more rare.Support for modern messaging brokersOne of the most common message brokers we see in use today with microservices is Kafka, and similar technologies such as AWS Kinesis are also gaining popularity. These differ from many traditional message brokers that map to JMS, in the following ways:* There are no transactions, and definitely no distributed transactions. Transactions are typically used to guarantee exactly once message processing. These modern message brokers however do not offer exactly once delivery, they offer at least once delivery, which means transactions don't give you anything, even if a publisher ensures that it only publishes each message once, it still could arrive at a consumer twice. The upshot of this is that what works for messaging handling when using transactions isn't necessarily a good fit for at least once messaging, and APIs may need to be adjusted accordingly.* Pub-sub is in the control of consumers. In traditional message brokers, you configure pub-sub in the broker, by creating a queue for each consumer, and routing messages appropriately. In Kafka and similar technologies, the consumer is in control here - a consumer can consume any message stream without impacting other consumers, and consumers can form groups that ensure that messages are distributed among the groups. One consequence of this is that you need consumer side APIs for specifying/joining these groups.* Partitioning. These message brokers partition messages for scaling and load balancing, and if you want any ordering guarantees (you usually do), then the producer needs to control how they are partitioned. This is done by the producer extracting a key from messages, and that key is then hashed to a partition.We've found that these concepts need to be first class concepts in the API for successful use in a microservices architecture.Streams integrationSources and sinks for message streams will often be from another API. For example, if using CQRS, very often your source of messages to publish to a broker will be a CQRS read side stream. A microservices messaging solution needs to compatible with different streaming sources and sinks, so that end users don't need to implement their own adapters between these technologies (which can be very difficult to do, especially if they want to implement robust back pressure propagation). Hence, such a messaging API should use a common interface for streaming, and of course Reactive Streams/JDK9 Flows is the prime candidate here.DistributionWhen plumbing streams together from different libraries to a message broker, distribution needs to be considered, and in our experience ends up being a first class concept in the end user APIs. A single service may consist of many nodes, publishing the stream from every node is not usually desirable since that means each message will be published once for each node doing the publishing. Sometimes you want a singleton node doing the publishing, sometimes if the source stream is sharded, you want to distribute the shards out across the cluster so that the publishing load is shared by all nodes in the service. We've found that end user APIs need to give the user control over this in order to implement it successfully.So, I've said a lot here, I'm interested in whether people agree with my assessment or not.--
I'd like to spend some time digging into Game On and its approach to messaging as background reading.I'd also like to see a discussion about use cases and how we envisage people actually using messaging with microservices. It would be good to get broad agreement about the use cases for the API before we actually start designing it.
I'd like to spend some time digging into Game On and its approach to messaging as background reading.I'd also like to see a discussion about use cases and how we envisage people actually using messaging with microservices. It would be good to get broad agreement about the use cases for the API before we actually start designing it.Here's one approach I've seen. Each microservice listens on its own topic. Messages published on the topic are really command messages to invoke the microservice. There can be multiple instances of each microservice, and the messages are shared among them. You can scale the microservice by running more instances. When a microservice needs to invoke another microservice, it publishes a message on that microservice's topic. There are no responses, just state changes as a result of the processing.
People also do async request/response. This is a less alien to people used to synchronous calls. For microservices, I suggest there's an anti-pattern. When an instance of a microservice makes a request by sending a message, it's a bad idea to depend on the same instance to handle the response. For availability and scalability, it's better to be able to handle the response in any instance of the calling microservice, rather than a specific instance.
There's also a multi-language API called MQ Light that we created with microservices in mind.Overview: https://github.com/mqlight/java-mqlightIt has some characteristics which I'd consider useful in a MicroProfile messaging API:
- Async, non-blocking interface
- Flow control for subscribers (but not back pressure)
- Sharing among subscribers
If you look at the examples, they're very verbose because it doesn't use any of the modern Java features like annotations and CDI. So, I offer it as an example of an interesting interface.Andrew Schofield
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/c0320d58-7db1-4fe7-b8a5-f4c790535493%40googlegroups.com.
Hi,
Remotely distributed transactions are a pain... I think we all agree on this. But for most applications (not only in the financial sector) they are a reality that we can't simply ignore. We have to have some mechanism to handle network or target system failures. Most often we go with retrying and idempotency... and that's a good approach; much better than two-phase commits.
But maybe we can choose where to handle this: in the application code or in the container. There's an awful lot of things you can do wrong and only notice sporadically, so it's better to not do this over and over again, but have one code base to rely on. So it would be nice to keep this by default out of the application code. But how?
Let's dream for a moment: The simplest thing for an application programmer would be to have exactly-once semantics:While generations of architects have dreamt of this logic to work for distributed systems, the performance impact on synchronous remote invocations has rightfully put a perpetual 'never-again' label on remote two-phase commits. REST carefully defines that PUT must be idempotent, GET never change any state, etc. So we retry and compensate things in our applications. I've seen some nasty bugs arising from doing it just almost right, but nobody said programming distributed systems would be all unicorns and rainbows. We have to live with that and I don't think we can or even should change it.
- When I receive a command message to update some data and that update fails for some reason, I want the database to go back to the state before my update and the message to be sent again. And it's über convenient not to care about idempotency, too: If the database update actually completed, I will never receive that message again.
- When I update my database and then send a message, I also want the message to not get out of the door when, e.g., some optimistic lock on the database fails. And I don't want to have the database updated without my message being sent, just because my machine crashes right between those two operations.
Asynchronous messaging OTOH (and JMS has proved this to be viable) allows us to do local XA transactions when sending as well as when receiving messages. Only when forwarding messages from one machine to another, we need retries and idempotency, but other than with synchronous calls, this can go unnoticed to the application code! Isn't this a good thing? No distributed two-phase commits slowing us down, and still the simplest programming model possible.
JMS has it's down-sides, though. Like other messaging systems (including Akka and Kafka), it's very technology centric. It's often difficult to see the business logic hidden in all that message handling, converting, and compensating. So you will pull that out and have the business code on one side and on the other side... hmmm... boilerplate?
Maybe this would be a good litmus test for any technology: How many lines of code, annotations, or concepts do you need to read/write/understand to send or receive a business message? This mail is already too long, so just a small teaser of the idea:@MessageApi
public interface CustomerService {
public void createCustomer(String firstName, String lastName);
}
Inject this to have a sender, implement it to have a receiver. For the full story, see https://java.net/projects/messageapi/pages/Home
I must admit that the project has totally fallen asleep, as I've moved to a different team where we mainly do REST.
I don't see any reason why this approach shouldn't work with batched messages or without transactions. I'd rather have those aspects visible in the code, as they do have side effects, but that's already going into details. I also would argue that the default should be one message per transaction, as this can scale out very well. Optimizing the last bit must be possible, but it also may be premature.
In the JMS 2.0 and 2.1 EG, I had tried to push into this direction, but I assume standardization and innovation are rightfully two different things. Maybe the playground-before-standardizing approach of MicroProfile is more open to this reduce-to-the-essential approach.
Regards
Rüdiger
BTW: I do think that standardizing the wire format would be a real benefit; but it's completely independent from standardizing the APIs.
--
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CAKF%2BbsrZSb36SWdjP6T9JMqPHsAucm_ujc-%3DZ4d0aYvKwObyzQ%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CAKeeVe534UzC2%2Bn4AccpQeooHXwEOJO5n7w5BHZTHJnH6Mr-uA%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CAKeeVe7wPjPShLOnc1qT6e768%2BMwy%3Di2UbryK1O6GqohtaiXjA%40mail.gmail.com.
Maybe this would be a good litmus test for any technology: How many lines of code, annotations, or concepts do you need to read/write/understand to send or receive a business message? This mail is already too long, so just a small teaser of the idea:@MessageApi
public interface CustomerService {
public void createCustomer(String firstName, String lastName);
}
@MessageApi(mode=LAZY_PERSIST, expiry=30000... etc)
public interface CustomerService {
public void createCustomer(String firstName, String lastName);
}
... snip
@MessageApi(consume=shared)
public class CustomerServiceImpl implements CustomerService {
public void createCustomer(String firstName, String lastName);
}
BTW: I do think that standardizing the wire format would be a real benefit; but it's completely independent from standardizing the APIs.
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/511963b6-94d5-4f78-a907-749a4950d222%40googlegroups.com.
Maybe this would be a good litmus test for any technology: How many lines of code, annotations, or concepts do you need to read/write/understand to send or receive a business message? This mail is already too long, so just a small teaser of the idea:@MessageApi
public interface CustomerService {
public void createCustomer(String firstName, String lastName);
}As a teaser, I think this looks great. The devil is in the details.. what to do with POJOs? Force everyone into XML or JSON? What about object serialization?
On the consumer side, does it default to shared subscription (round-robin) or exclusive?
How would headers or meta-data (messageId, expiry, etc) be injected?
My concern is that this just ends up moving code into an annotation or some behind the scenes backing file.@MessageApi(mode=LAZY_PERSIST, expiry=30000... etc)
public interface CustomerService {
public void createCustomer(String firstName, String lastName);
}
... snip
@MessageApi(consume=shared)
public class CustomerServiceImpl implements CustomerService {
public void createCustomer(String firstName, String lastName);
}
BTW: I do think that standardizing the wire format would be a real benefit; but it's completely independent from standardizing the APIs.+1
public interface CustomerService {
public void createCustomer(String firstName, String lastName);
}
createCustomer that's void, instead of returning the actual Customer PoJO?Why wouldpublic interface CustomerService {
public void createCustomer(String firstName, String lastName);
}
have a methodcreateCustomerthat's void, instead of returning the actualCustomerPoJO?
Hi,I've taken a look at your suggested API here https://github.com/jroper/java-messaging. It looks quite interesting and have some comments.I agree that the overall idea of considering the messages as a stream is a good one. The ideas in RxJava and Reactive Streams are very nice and expressive, so an API based on these principles seems attractive to me. I'd like to be able to use the Observable pattern for messaging applications and have producers and consumers fit in well with that pattern.The idea of back-pressure in these reactive systems is good. I can see how you could prevent overly ambitious reading from a network connection and keep control of the memory use. I'm more sceptical about trying to apply the idea across networks connections for a distributed publish/subscribe system.
I'm a bit surprised by the presence of the MessageBroker as a class in the API. I think of the broker as part of the messaging infrastructure, either local or remote to the code using the API, which you'd not actually represent as a class.
Do you have any views on the relative merits of Reactive Streams and RxJava as building blocks for a messaging API?
Try to reactivate this thread. This is a very useful discussion. What is the next step? Should a repo be created to demonstrate the apis etc?Emily
--
You received this message because you are subscribed to a topic in the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/5eb3222d-2b10-4ddc-aee2-1d7bf9a4e555%40googlegroups.com.
Hi James,
Can you do a PR in https://github.com/eclipse/microprofile-sandbox with what you mentioned in your reply (readme, and/or simple APIs)? Once it is done, we can have a brief discussion. If the content looks good, we will get a dedicated repo created and port the readme over.
Thanks,
Emily
To unsubscribe from this group and all its topics, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/5eb3222d-2b10-4ddc-aee2-1d7bf9a4e555%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/3d974b08-0cd3-4199-80c4-b1c8f5789ccd%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/3d974b08-0cd3-4199-80c4-b1c8f5789ccd%40googlegroups.com.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/993ef71e-34ef-4d93-a28a-c32179422c93%40googlegroups.com.
On 20 Feb 2018, at 06:05, James Roper <ja...@lightbend.com> wrote:Hi Emily and Kevin,One thing that concerns me with the MicroProfile route is if you look at this thread, we've been talking about messaging APIs for almost 18 months, I even put forward a possible API for discussion, but as far as next steps are concerned, there's always been an invisible wall where we've been met with unclear answers about how to actually start a project, and progress etc.
I'm worried that going down this route, we will only encounter more of the same. I have no insight at the moment as to how successful any attempt at contribution to MicroProfile will be, I've only got this past experience which hasn't been all that positive.In contrast, on the EE4J side, even without EE4J policies themselves being established, we can see very clear policies published for how to start a new Eclipse project,
and we've had people involved with EE4J not just ask but push us very strongly into contributing.
Of course it remains to be seen whether we'll encounter the same wall we've encountered in MicroProfile, but we feel somewhat more optimistic here.Timing-wise, we're really interested in a Reactive Streams based approach. Reactive Streams requires JDK9 (since java.util.concurrent.Flow was introduced in JDK9), and I don't think MicroProfile or EE4J are anywhere near adopting JDK9 (or any subsequent JDK version), particularly given the current state of flux that Oracle has created regarding support periods for OpenJDK. So even if we can officially start sooner with MicroProfile, it's going to be some time before any final spec can be published.
I'll be happy to start the project in MicroProfile if my fears can be belayed. For example, maybe no one in MicroProfile will be interested in the approach that we'd like to propose - the thing I need to know is how much effort will it take me to get to that stage where we know that the spec is not going to fly?
I haven't got a lot of feedback so far on whether the things I've proposed are liked or not. I need to report to my bosses a set of milestones and criteria for continued investment, so that we don't go down the rabbit hole of spending a year investing in a spec that doesn't get adopted.
You received this message because you are subscribed to the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CABY0rKOGsyX6-fs5zuG0rGTnMUkQ-iO4cs-E1tEz45QAKdwmdA%40mail.gmail.com.
Hi James/Mark,How about this for some practical next steps:
- Let's use the MP-Sandbox repo more as an incubating space and start a messaging spec there
- We (I) can start a new Gitter chat room for it to have more immediate discussions
- We can set up a fortnightly hangout for MP-Sandbox where we can discuss in-progress specs
- This can either be a single working group or a couple based on the kind of APIs being discussed.
This approach may not scale so well, so I would propose aims of spending 3 months in an "incubating" cycle and then present the spec to the general hangout or this group for inclusion as a more formal spec.I'm strongly against adding more ceremony to the process, so the above points are NOT requirements, but more suggested steps that help in development of new things.What do you think? I would be happy to contribute to get these things started, but I'm spread quite thin at the moment so probably couldn't commit to really working on this. There may well be other people keen to get involved with things like Messaging both in the group and in the community who might want to help though.
--
You received this message because you are subscribed to a topic in the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/31b35527-a6df-471b-9c47-94e8ab411e61%40googlegroups.com.
To unsubscribe from this group and all its topics, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
> To post to this group, send email to microp...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/microprofile/d218761e-df19-4065-b528-7713d747e1fa%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
--
Clebert Suconic
--
You received this message because you are subscribed to a topic in the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CAKF%2Bbsp_jUaTQ%3DYPAP%3DAL9mWkc-nNTuH%2BX2HETj7s79-Pr6hFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
I would like to get involved on this again. and I want to be totally
independent from JMS. so.. where you guys usually hang for this?
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/fef68384-f50e-4446-9541-34efe597abf4%40googlegroups.com.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/8ca73236-5376-4f2d-b983-bc12bee8562c%40googlegroups.com.
I have some embedded text on your original email.
> But of course, there are many use cases where this is not a good fit, where
> people either want to publish a message as the primary side effect of a REST
> POST for example, or they may want to publish a message along with a
> database update, perhaps using transactions or maybe not, or they may just
> want to emit messages on certain events in the application in more of a
> monitoring capacity. For that we do need a non streams based imperative
> solution. I'd suggest that we allow injecting an interface that provides
> this method of publishing, perhaps annotated with @Egress.
I like the idea of CDI as a tool to help with boilerplates.. but there
should be a way to instantiate with objects directly as well.
Or is everything else in Microprofile based on CDI? and that is the
fashion used?
> I would be very interested to hear what people thought on either/both
> publishing approaches. I'll implement the publisher use case, as that's
> quite straight forward, and I'll have a go at implementing injecting an
> imperative publisher, though that will be pushing my knowledge of CDI to
> make that work.
>
> Also related, in microservices commonly you have use cases that are both
> ingress and egress, ie where you're processing a stream of messages and
> producing a new stream, and so we could offer a Flow.Processor based
> solution for that.
In my experience, what about just keep it simple. send message.. and
receive message?
if users will forward a message that should be just like forwarding an
email to a new address IMO.
> We may also want to consider whether more complex graphs
> should be supported, eg fan in/fan out, balancing, broadcast etc.
Shouldn't that be up to the implementations? As far as the client is
concerned all you need is to receive and send messages.
> this is where it could get very interesting, but its also where it could get
> very complex, and admittedly these more complex graphs I don't have a lot of
> experience in providing framework level APIs for allowing users to implement
> them. So I think limiting the scope to just processors would be good, but we
> should keep in mind the more complex graphs.
If we keep the basic usecase well done.. users can make complex usage
as they wish just like a math formula. Give the user a simple tool and
that will be very powerful.
> For the commit method - this is a place where I think we need to have a lot
> more discussion. The suggestion to call it ack I think is a good one. But
> the approach where committing/acking is done explicitly with a method call
> (ie, what I've implemented here) has a number of limitations -
I think ack should mean ack. Lets keep it simple?
@Outgoing and Incoming would sound weird?
If we can't find any other names I'm fine with that... just pointing
that it feels complex for a non native speaker.
--
You received this message because you are subscribed to a topic in the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CAKF%2BbspMNu%3D9bcu5pK-dDrq6q-ubR-K3p%2Bey0cGV8vcuwbVs5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/86D1B4A9-29E7-4D12-B6DA-92B06BFAA01D%40gmail.com.
I understand that all MP specs must play really, really nicely with CDI. OTOH, if the specs actually depend on features from CDI, they won’t be acceptable by, e.g., Spring or Dropwizard. I know that this is not a big concern for most of us, but in the long term it may prove fruitful to have those guys in the game, too, by restricting DI to what’s in ‘javax.inject’. A broad adoption of a spec helps everybody!
Just my 2 ct.
Rüdiger
> On 2018-03-01, at 12:22, Ondrej Mihályi <ondrej....@gmail.com> wrote:
>
> The CDI first policy means that any spec should focus on CDI-based API and add more general API later. It's not a hard requirement but a strong preference. A spec without a high-quality CDI based API has low chance to be accepted to MP.
>
> Ondro
>
> Dňa 1. 3. 2018 10:07 AM používateľ "Mark Little" <markc...@gmail.com> napísal:
> MicroProfile has a CDI-first policy for specifications.
>
> Mark.
>
>
>> On 1 Mar 2018, at 01:37, Clebert Suconic <clebert...@gmail.com> wrote:
>>
>> I like the idea of CDI as a tool to help with boilerplates.. but there
>> should be a way to instantiate with objects directly as well.
>> Or is everything else in Microprofile based on CDI? and that is the
>> fashion used?
>
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "Eclipse MicroProfile" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
> To post to this group, send email to microp...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/86D1B4A9-29E7-4D12-B6DA-92B06BFAA01D%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "Eclipse MicroProfile" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CACZTZYVMB92f5Xw-GH6MfhXUQ_Rn-1LZbZZVj_KJa6EBoCuZWg%40mail.gmail.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/1E40403E-FB5B-4076-BA24-E1C16F151779%40googlemail.com.
--
You received this message because you are subscribed to the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CACZTZYUuNu%2BG5%2BZv4DU-%3DV7i3fSauH5O5JPCysNiE7mNjsP9%3DA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CAKeeVe7R_UFW9dUJ0Zd1UCoxDuhKqKeiX%2BTXAK8hqs%3D7F6m2og%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CACZTZYXSBGu8v8AdEH8SDVQHYByUNdLuDj4xQax4Xhihwqu-jg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CABY0rKP9arnF2B_QRmV%2B6cy2BiKM1pcnw4ME5hdmXo1_pCJm%3Dw%40mail.gmail.com.
>> To post to this group, send email to microp...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/microprofile/8ca73236-5376-4f2d-b983-bc12bee8562c%40googlegroups.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> James Roper
> Senior Octonaut
>
> Lightbend – Build reactive apps!
> Twitter: @jroper
>
> --
> You received this message because you are subscribed to the Google Groups
> "Eclipse MicroProfile" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to microprofile+unsubscribe@googlegroups.com.
> To post to this group, send email to microp...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/microprofile/CABY0rKOEg_m2z55Yn4VZ%2BJGRrCtrtrbTOcj%2BvV8-trHLjv2Yjg%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/slv8lk_1smU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CAFitrpR0Ui4s0bkaOo%2BxCxMLz2bY5CGRyiq8NQEx5C44q2ig6w%40mail.gmail.com.
&g
I also suggest not to use Ingress and Egress as they are used by Istio or Kube. People will be easily confused with the same names.
How about @MessageProducer or @MessageConsumer?
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/48a234c7-c551-4a8b-a2f4-18e8fef18589%40googlegroups.com.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CALbocOkXYndWGAshmwF9sey8V_rjEh3d9msaVAN2%3DBkVxhVuCA%40mail.gmail.com.
Hi all,I've just pushed a major update:So firstly, I renamed @Ingress to @Incoming. I think the naming of this is far from over, and I don't think it's bikeshedding to talk about it - this is a very important part of the API to get right! I think it'll be worth renaming it a few times and having a look at what the code looks like with each name.What this update adds though is multiple different ways to declare subscribers and to ack messages. Importantly, I'm not saying that we *should* support all these ways, just because we can provide something doesn't mean we should, and having too many different options is a bad thing. But I've provided them so that we can compare them side by side.If you look at the UserDetailsSubscriber now, you'll see 6 different methods that essentially do exactly the same thing, but all in a slightly different way. The original method of returning a Subscriber is still there.The second method, handleUserDetails2, takes a UserDetailsEvent, and returns CompletionStage<Void>. In this case, there's no Envelope, for this purpose there doesn't need to be, the redemption of the returned CompletionStage successfully (rather than with an error) indicates that the message has been successfully processed and so is an implied ack. I think this option is important, because if you look at all the other options, we need a third party library (I've chosen Akka Streams, but I could have chosen Reactor or RxJava) to build the subscribers, and I think there needs to be a straight forward option that doesn't require a third party library. Work is being done in the JDK at the moment to provide a library in the JDK that will fill this role, so this won't always be an issue, but for now, it is.The third method, handleUserDetails3, is like handleUserDetails2, but returns void, and takes an Envelope, so the message is acked explicitly. I don't like this method, since it doesn't allow propagation of backpressure (unless the underlying message broker technology allows propagating backpressure through acks, Kafka for example though doesn't, also there's no way to ensure acks are done in order).The fourth method, handleUserDetails4, I think is really interesting and should be paid close attention to, as it demonstrates why using reactive streams can be very powerful. In this case we are batching messages into groups of up to 20, and then persisting them all using batched statements on Cassadra. Now Cassandra experts may point out that batched statements don't necessarily increase throughput on Cassandra - but there are many other use cases and databases where doing things in batches can significantly increase throughput. Having this option I think is very desirable, this is just the beginning of what can be done, at customers that I've worked with we've used reactive streams to farm work out to a cluster of machines, to cluster groups of similar messages together so they can be deduplicated to prevent unnecessary processing etc. Also note the different approach to acking here, this method returns a Processor<Envelope<UserEvent>, Ack>, that is, it's transforming user messages to acknowledgements of messages, which I think is an elegant way to view the stream handling. And in this case, we only acknowledge the last message of each batch, so we significantly reduce the acknowledgement overhead, and it puts the user in direct control of exactly how much acknowledging is or isn't done.The fifth method, handleUserDetails5, is almost identical to the first, with one small difference, it's using org.reactivestreams.Subscriber, rather than java.util.concurrent.Flow.Subscriber. This shows how an implementation can support both versions of the API simultaneously.Finally, the sixth method, handleUserDetails6, is just there to demonstrate that implementations of this API can provide support for their own types, here I've provided support for Akka Streams Flow. Of course, using this means your code is not portable to different implementations of the API. Another thing about this method is that it doesn't take an Envelope, it just takes the raw message, and emits Done (an Akka unit type like void), one per message, so the acks are implied by the emission of Done.So there's a lot to mull over here, and as I said, I am in no way proposing that we support all of these methods of consuming streams, they are only provided for side by side comparison.Regards,James
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CALbocOkXYndWGAshmwF9sey8V_rjEh3d9msaVAN2%3DBkVxhVuCA%40mail.gmail.com.
--
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CALbocOkXYndWGAshmwF9sey8V_rjEh3d9msaVAN2%3DBkVxhVuCA%40mail.gmail.com.