component

2020-06-10T03:40:40.028700Z

Yeah you’re right sorry It git removed when I was trying to remove unnecessary code

2020-06-10T03:49:59.036500Z

The thing is that the dependency on state-component is specified in the defrecord for IM-Proto-0 and then everywhere else - specially where this code is included as a library- I’m creating a system that has a IM-Proto-0 component I should supply the dependency using component/using .

2020-06-10T03:51:52.038600Z

How could I make it easier for clients of this library to use and maintain their code using my components?

seancorfield 2020-06-10T03:52:53.038900Z

But every use could be injecting a different thing for the state-component

2020-06-10T04:05:31.046900Z

Yeah you’re right but the thing is how should they know that there is a state-component dependency at all? I think I didn’t explain the problem well. We wanted the im.access/create multimethod to hide implementation details of a component whose different versions may have different component dependencies. For instance one implementation uses only a Hazelcast client component and another uses Redis in conjuction with a Postgres. Which is determined dynamically by their configurations.

seancorfield 2020-06-10T04:09:04.052600Z

The dependencies have to be computed before you start the overall system.

2020-06-10T04:09:28.052900Z

In some of our projects we used to construct a system map at each component level and put the component/using there and merge these subsystem at top level (we followed an article on best practices of using component library) but that also made the code not exportable as a library since we were limiting the users of the components in their injection (they had to name the dependency exactly what we had set for the component)

seancorfield 2020-06-10T04:09:57.053100Z

If the dependencies are derived from the configuration, then you need to load the configuration first, then use it to build the using dependency map.

seancorfield 2020-06-10T04:11:01.054200Z

Or you need to abstract over the things that can vary.

👍 1
seancorfield 2020-06-10T04:11:50.054700Z

Do you have the exact same API over Hazelcast that you have over the Redis/PostgreSQL combo?

2020-06-10T04:12:32.055900Z

Hmm no they’re different There are two separate very different implementations for those

seancorfield 2020-06-10T04:12:48.056200Z

Either way, you're going to need to process the configuration first, use that to drive the construction of the components and/or the using dependency map, and then start it.

seancorfield 2020-06-10T04:14:03.056400Z

So it might be that you need a component, based on configuration, that when it start's up produces your actual system component with all its dependencies, and then you start that?

👏 1
2020-06-10T04:18:27.059700Z

Yeah you’re totally right That seems a lot better Thanks a lot @seancorfield