1

I always heard hexagonal architecture has to be agnostic of any framework and use interfaces (SPI) to delegate each part of code which does not belong to the business layer.

But how to create a reactive business layer thanks to hexagonal architecture without using additional framework? Most of the time SPI's implementations will be reactive (API's implementations/adaptations also) and the core of the business layer should also be reactive.

Is there any JSR (implemented by each reactive framework) to use? Or should I define my own and perform adaptations with the final framework I will use in infra part?

OlivierTerrien
  • 1,911
  • 16
  • 28
  • When you say reactive framework I assume you mean library (like RxJava or Reactor). That would also answer your question. – a better oliver Mar 22 '19 at 19:39
  • 1
    Yes, I mean RxJava or Reactor. But that does not answer to my question. If I use one of these framework, I am not compatible with the other. That is especially the problem. Morevor, as far as I know, it shouldn't be possible to create any hexagon with a dedicated framework otherwise this hexagon is stronly linked to this framework and cannot be used in another way. – OlivierTerrien Mar 22 '19 at 21:32
  • A library is not a framework. And yes, Java 9 provides a set of standard interfaces. Even without them: the core defines the contract. If an adapter uses a different library, so be it! – a better oliver Mar 30 '19 at 16:06

1 Answers1

1

I've never developed software following a reactive programming approach, I don't know much about it... but I know it is a programming paradigm, so it defines the way you have to write source code, how you have to structure it, etc.

From my point of view, RxJava wouldn't be considered as a framework, in the sense of technology that you use to communicate with the actors living outside your application. RxJava would be an extension to a programming language (Java) that lacks the chance of writing reactive code with it.

So I see no problem using RxJava to write the hexagon source code.

choquero70
  • 3,332
  • 2
  • 24
  • 40
  • Thank you choquero70, but if I use RxJava to write my hexagon, I will have to adapat, at least, this code when I will have to write thé infra part in spring boot reactive because RxJava and Reactor is not the same. – OlivierTerrien Mar 27 '19 at 06:31
  • Well, as I said, I don't know much about reactive programming stuff. I will take a look a little bit deeper if I can and I will tell you. But basically the idea is that reactive tools wouldn't be considered technology, so you could use them in the hexagon, because they are for writing software according to a philosophy, a paradigm because the programming language you use lacks of it. If you were using a programming language including it, you wouldn't need them. I consider them part of the programming language – choquero70 Mar 27 '19 at 07:26