Skip to content

schedule based on bean names next to classes #1003

@stephanpelikan

Description

@stephanpelikan

I'm providing a Spring based framework VanillaBP which implements hexagonal architecture for using business processing management systems (BPMS). However, in this framework multiple Spring beans are created implementing a generic interface ProcessService<A> using the prototype scope. Currently, this framework is also ported to Quarkus using a similar mechanism. I want to use transaction-outbox in those beans because with BPMS one has to deal with eventual consistency and idempotency.

So, at runtime there are multiple beans of a class ProcessService having a different bean name. Actually, there are as many beans as there are injection points having different generic parameters:

   @Autowired private ProcessService<MyClassA> firstProcessService; // bean name "ProcessService_MyClassA"

   @Autowired private ProcessService<MyClassB> secondProcessService; // bean name "ProcessService_MyClassB"

   @Autowired private ProcessService<MyClassA> thirdProcessService; // same bean as firstProcessService

Now, due to this scenario I need to not only address a bean by its type - better by its bean name.

So, I ask for an additional method TransactionOutbox#schedule taking two parameters:

<T> T schedule(Class<T> clazz, String name);

Instead of using Instantiator#getName(Class) the given name is stored and finally passed to Instantiator#getInstance(String).

As a side-effect this may also help in other scenarios in which an interface is passed as clazz and the actual implementation's classname is passed as name. Or an function based instantiator does a lookup in some static map to pick an existing instance rather than creating a new one.

Is this a useful extension for the transaction-outbox? Or maybe you have ideas how to use transaction-outbox in my scenario without extending your API?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions