You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Łukasz Dywicki <lu...@code-house.org> on 2022/10/12 22:27:52 UTC

Ignite support for IoC beyond spring framework

Hello,
I would like to bring a proposal for Ignite to include support for 
@SpringResource without spring at all.
We currently use ignite without Spring Framework and, to make things 
harder, under OSGi. As a part of exercise couple weeks ago I implemented 
support for IoC [1] in environment we run. I did it by simulating 
spring's ApplicationContext instance expected by IgnitionEx [2] and 
GridSpringResourceContext.

Turns out that Ignite IoC is fine with below API:
public interface BeanRegistry {
     <T> T lookup(Class<T> type);
     Object lookup(String name);
}

Given that we look forward to keep use of Ignite I was asked to 
contribute my work back to your project.
Would you be up to discuss, and if agreed, guide me on a shape of ioc 
updates which would best fit Ignite itself? If you do not expect changes 
in Spring integration then, maybe we could get a working solution within 
ignite-osgi itself?

Best,
Łukasz

[1] 
https://github.com/OpenNMS/horizon-stream/tree/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/resource

[2] 
https://github.com/OpenNMS/horizon-stream/blob/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/IgnitionFactory.java#L15

Re: Ignite support for IoC beyond spring framework

Posted by Łukasz Dywicki <lu...@code-house.org>.
Hello,
I would like to check again status on proposed changes as the pull 
request went over first (and I think second) cycle of reviews.
Looking forward for your feedback and possibility to include these 
changes in Ignite 2.15 release.

Kind regards,
Łukasz

On 17.10.2022 18:56, Łukasz Dywicki wrote:
> Going forward over evaluation - I think for naming consistency reasons 
> we shall stay with @InjectResource cause other annotations which bring 
> outside values are @SpringResource, @LoggerResource and 
> @IgniteInstanceResource.
> 
> Making it @IgniteInject is fine for me too, but it might not fit into 
> existing package contents. WDYT?
> 
> Best,
> Łukasz
> 
> On 17.10.2022 16:48, Łukasz Dywicki wrote:
>> I created https://issues.apache.org/jira/browse/IGNITE-17915.
>> Going to try updating code and see how much impact it will have.
>>
>> Best,
>> Łukasz
>>
>> On 14.10.2022 20:21, Łukasz Dywicki wrote:
>>> Hello Semyon,
>>> I wasn't sure if deprecation of @SpringResource would be acceptable, 
>>> if so It gives us more flexibility in bringing IoC adapter layer. 
>>> Linked code is just fitted into existing boundaries, but I can update 
>>> it to deal with @IgniteInject.
>>>
>>> I will register feature request/improvement in JIRA and start working 
>>> on it next week.
>>>
>>> Kind regards,
>>> Łukasz
>>>
>>> On 14.10.2022 16:26, Данилов Семён wrote:
>>>> Hi!
>>>>
>>>> This sounds like a good enhancement. Feel free to create a pull 
>>>> request!
>>>> As I see it, for now we should continue using SpringResource 
>>>> annotation (even if it injects non-spring resources), but at the 
>>>> same time create a new annotation (maybe something like 
>>>> @IgniteInject, I am bad with naming) and deprecate SpringResource 
>>>> annotation. Both annotations should work exactly the same.
>>>> Then we will have a spring version of injector interface and some 
>>>> generic version that any user can extend and use without spring.
>>>> WDYT?
>>>>
>>>> P.S. You can create a JIRA ticket and mention me there, I'll be 
>>>> happy to review and merge your PR
>>>>
>>>> Kind regards, Semyon.
>>>>
>>>>
>>>>> Hello,
>>>>> I would like to bring a proposal for Ignite to include support for
>>>>> @SpringResource without spring at all.
>>>>> We currently use ignite without Spring Framework and, to make things
>>>>> harder, under OSGi. As a part of exercise couple weeks ago I 
>>>>> implemented
>>>>> support for IoC [1] in environment we run. I did it by simulating
>>>>> spring's ApplicationContext instance expected by IgnitionEx [2] and
>>>>> GridSpringResourceContext.
>>>>>
>>>>> Turns out that Ignite IoC is fine with below API:
>>>>> public interface BeanRegistry {
>>>>> <T> T lookup(Class<T> type);
>>>>> Object lookup(String name);
>>>>> }
>>>>>
>>>>> Given that we look forward to keep use of Ignite I was asked to
>>>>> contribute my work back to your project.
>>>>> Would you be up to discuss, and if agreed, guide me on a shape of ioc
>>>>> updates which would best fit Ignite itself? If you do not expect 
>>>>> changes
>>>>> in Spring integration then, maybe we could get a working solution 
>>>>> within
>>>>> ignite-osgi itself?
>>>>>
>>>>> Best,
>>>>> Łukasz
>>>>>
>>>>> [1]
>>>>> https://github.com/OpenNMS/horizon-stream/tree/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/resource
>>>>>
>>>>> [2]
>>>>> https://github.com/OpenNMS/horizon-stream/blob/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/IgnitionFactory.java#L15

Re:Ignite support for IoC beyond spring framework

Posted by Данилов Семён <sa...@yandex.ru>.
Hello! 

I've started the review of your PR, should be ready tomorrow, but looks good overall!

Kind regards, Semyon.

Re: Ignite support for IoC beyond spring framework

Posted by Łukasz Dywicki <lu...@code-house.org>.
Hello,
I brought first version of PR, for now with limited set of tests:
https://github.com/apache/ignite/pull/10337

If you're ok with approach I've taken I can continue on satisfying 
quality criteria and stabilization of it.
I made a sample Spring registry to prove how "injection source" could 
look a like.

Best,
Łukasz

On 17.10.2022 18:56, Łukasz Dywicki wrote:
> Going forward over evaluation - I think for naming consistency reasons 
> we shall stay with @InjectResource cause other annotations which bring 
> outside values are @SpringResource, @LoggerResource and 
> @IgniteInstanceResource.
> 
> Making it @IgniteInject is fine for me too, but it might not fit into 
> existing package contents. WDYT?
> 
> Best,
> Łukasz
> 
> On 17.10.2022 16:48, Łukasz Dywicki wrote:
>> I created https://issues.apache.org/jira/browse/IGNITE-17915.
>> Going to try updating code and see how much impact it will have.
>>
>> Best,
>> Łukasz
>>
>> On 14.10.2022 20:21, Łukasz Dywicki wrote:
>>> Hello Semyon,
>>> I wasn't sure if deprecation of @SpringResource would be acceptable, 
>>> if so It gives us more flexibility in bringing IoC adapter layer. 
>>> Linked code is just fitted into existing boundaries, but I can update 
>>> it to deal with @IgniteInject.
>>>
>>> I will register feature request/improvement in JIRA and start working 
>>> on it next week.
>>>
>>> Kind regards,
>>> Łukasz
>>>
>>> On 14.10.2022 16:26, Данилов Семён wrote:
>>>> Hi!
>>>>
>>>> This sounds like a good enhancement. Feel free to create a pull 
>>>> request!
>>>> As I see it, for now we should continue using SpringResource 
>>>> annotation (even if it injects non-spring resources), but at the 
>>>> same time create a new annotation (maybe something like 
>>>> @IgniteInject, I am bad with naming) and deprecate SpringResource 
>>>> annotation. Both annotations should work exactly the same.
>>>> Then we will have a spring version of injector interface and some 
>>>> generic version that any user can extend and use without spring.
>>>> WDYT?
>>>>
>>>> P.S. You can create a JIRA ticket and mention me there, I'll be 
>>>> happy to review and merge your PR
>>>>
>>>> Kind regards, Semyon.
>>>>
>>>>
>>>>> Hello,
>>>>> I would like to bring a proposal for Ignite to include support for
>>>>> @SpringResource without spring at all.
>>>>> We currently use ignite without Spring Framework and, to make things
>>>>> harder, under OSGi. As a part of exercise couple weeks ago I 
>>>>> implemented
>>>>> support for IoC [1] in environment we run. I did it by simulating
>>>>> spring's ApplicationContext instance expected by IgnitionEx [2] and
>>>>> GridSpringResourceContext.
>>>>>
>>>>> Turns out that Ignite IoC is fine with below API:
>>>>> public interface BeanRegistry {
>>>>> <T> T lookup(Class<T> type);
>>>>> Object lookup(String name);
>>>>> }
>>>>>
>>>>> Given that we look forward to keep use of Ignite I was asked to
>>>>> contribute my work back to your project.
>>>>> Would you be up to discuss, and if agreed, guide me on a shape of ioc
>>>>> updates which would best fit Ignite itself? If you do not expect 
>>>>> changes
>>>>> in Spring integration then, maybe we could get a working solution 
>>>>> within
>>>>> ignite-osgi itself?
>>>>>
>>>>> Best,
>>>>> Łukasz
>>>>>
>>>>> [1]
>>>>> https://github.com/OpenNMS/horizon-stream/tree/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/resource
>>>>>
>>>>> [2]
>>>>> https://github.com/OpenNMS/horizon-stream/blob/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/IgnitionFactory.java#L15

Re: Ignite support for IoC beyond spring framework

Posted by Łukasz Dywicki <lu...@code-house.org>.
Going forward over evaluation - I think for naming consistency reasons 
we shall stay with @InjectResource cause other annotations which bring 
outside values are @SpringResource, @LoggerResource and 
@IgniteInstanceResource.

Making it @IgniteInject is fine for me too, but it might not fit into 
existing package contents. WDYT?

Best,
Łukasz

On 17.10.2022 16:48, Łukasz Dywicki wrote:
> I created https://issues.apache.org/jira/browse/IGNITE-17915.
> Going to try updating code and see how much impact it will have.
> 
> Best,
> Łukasz
> 
> On 14.10.2022 20:21, Łukasz Dywicki wrote:
>> Hello Semyon,
>> I wasn't sure if deprecation of @SpringResource would be acceptable, 
>> if so It gives us more flexibility in bringing IoC adapter layer. 
>> Linked code is just fitted into existing boundaries, but I can update 
>> it to deal with @IgniteInject.
>>
>> I will register feature request/improvement in JIRA and start working 
>> on it next week.
>>
>> Kind regards,
>> Łukasz
>>
>> On 14.10.2022 16:26, Данилов Семён wrote:
>>> Hi!
>>>
>>> This sounds like a good enhancement. Feel free to create a pull request!
>>> As I see it, for now we should continue using SpringResource 
>>> annotation (even if it injects non-spring resources), but at the same 
>>> time create a new annotation (maybe something like @IgniteInject, I 
>>> am bad with naming) and deprecate SpringResource annotation. Both 
>>> annotations should work exactly the same.
>>> Then we will have a spring version of injector interface and some 
>>> generic version that any user can extend and use without spring.
>>> WDYT?
>>>
>>> P.S. You can create a JIRA ticket and mention me there, I'll be happy 
>>> to review and merge your PR
>>>
>>> Kind regards, Semyon.
>>>
>>>
>>>> Hello,
>>>> I would like to bring a proposal for Ignite to include support for
>>>> @SpringResource without spring at all.
>>>> We currently use ignite without Spring Framework and, to make things
>>>> harder, under OSGi. As a part of exercise couple weeks ago I 
>>>> implemented
>>>> support for IoC [1] in environment we run. I did it by simulating
>>>> spring's ApplicationContext instance expected by IgnitionEx [2] and
>>>> GridSpringResourceContext.
>>>>
>>>> Turns out that Ignite IoC is fine with below API:
>>>> public interface BeanRegistry {
>>>> <T> T lookup(Class<T> type);
>>>> Object lookup(String name);
>>>> }
>>>>
>>>> Given that we look forward to keep use of Ignite I was asked to
>>>> contribute my work back to your project.
>>>> Would you be up to discuss, and if agreed, guide me on a shape of ioc
>>>> updates which would best fit Ignite itself? If you do not expect 
>>>> changes
>>>> in Spring integration then, maybe we could get a working solution 
>>>> within
>>>> ignite-osgi itself?
>>>>
>>>> Best,
>>>> Łukasz
>>>>
>>>> [1]
>>>> https://github.com/OpenNMS/horizon-stream/tree/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/resource
>>>>
>>>> [2]
>>>> https://github.com/OpenNMS/horizon-stream/blob/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/IgnitionFactory.java#L15

Re: Ignite support for IoC beyond spring framework

Posted by Łukasz Dywicki <lu...@code-house.org>.
I created https://issues.apache.org/jira/browse/IGNITE-17915.
Going to try updating code and see how much impact it will have.

Best,
Łukasz

On 14.10.2022 20:21, Łukasz Dywicki wrote:
> Hello Semyon,
> I wasn't sure if deprecation of @SpringResource would be acceptable, if 
> so It gives us more flexibility in bringing IoC adapter layer. Linked 
> code is just fitted into existing boundaries, but I can update it to 
> deal with @IgniteInject.
> 
> I will register feature request/improvement in JIRA and start working on 
> it next week.
> 
> Kind regards,
> Łukasz
> 
> On 14.10.2022 16:26, Данилов Семён wrote:
>> Hi!
>>
>> This sounds like a good enhancement. Feel free to create a pull request!
>> As I see it, for now we should continue using SpringResource 
>> annotation (even if it injects non-spring resources), but at the same 
>> time create a new annotation (maybe something like @IgniteInject, I am 
>> bad with naming) and deprecate SpringResource annotation. Both 
>> annotations should work exactly the same.
>> Then we will have a spring version of injector interface and some 
>> generic version that any user can extend and use without spring.
>> WDYT?
>>
>> P.S. You can create a JIRA ticket and mention me there, I'll be happy 
>> to review and merge your PR
>>
>> Kind regards, Semyon.
>>
>>
>>> Hello,
>>> I would like to bring a proposal for Ignite to include support for
>>> @SpringResource without spring at all.
>>> We currently use ignite without Spring Framework and, to make things
>>> harder, under OSGi. As a part of exercise couple weeks ago I implemented
>>> support for IoC [1] in environment we run. I did it by simulating
>>> spring's ApplicationContext instance expected by IgnitionEx [2] and
>>> GridSpringResourceContext.
>>>
>>> Turns out that Ignite IoC is fine with below API:
>>> public interface BeanRegistry {
>>> <T> T lookup(Class<T> type);
>>> Object lookup(String name);
>>> }
>>>
>>> Given that we look forward to keep use of Ignite I was asked to
>>> contribute my work back to your project.
>>> Would you be up to discuss, and if agreed, guide me on a shape of ioc
>>> updates which would best fit Ignite itself? If you do not expect changes
>>> in Spring integration then, maybe we could get a working solution within
>>> ignite-osgi itself?
>>>
>>> Best,
>>> Łukasz
>>>
>>> [1]
>>> https://github.com/OpenNMS/horizon-stream/tree/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/resource
>>>
>>> [2]
>>> https://github.com/OpenNMS/horizon-stream/blob/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/IgnitionFactory.java#L15

Re: Ignite support for IoC beyond spring framework

Posted by Łukasz Dywicki <lu...@code-house.org>.
Hello Semyon,
I wasn't sure if deprecation of @SpringResource would be acceptable, if 
so It gives us more flexibility in bringing IoC adapter layer. Linked 
code is just fitted into existing boundaries, but I can update it to 
deal with @IgniteInject.

I will register feature request/improvement in JIRA and start working on 
it next week.

Kind regards,
Łukasz

On 14.10.2022 16:26, Данилов Семён wrote:
> Hi!
> 
> This sounds like a good enhancement. Feel free to create a pull request!
> As I see it, for now we should continue using SpringResource annotation (even if it injects non-spring resources), but at the same time create a new annotation (maybe something like @IgniteInject, I am bad with naming) and deprecate SpringResource annotation. Both annotations should work exactly the same.
> Then we will have a spring version of injector interface and some generic version that any user can extend and use without spring.
> WDYT?
> 
> P.S. You can create a JIRA ticket and mention me there, I'll be happy to review and merge your PR
> 
> Kind regards, Semyon.
> 
> 
>> Hello,
>> I would like to bring a proposal for Ignite to include support for
>> @SpringResource without spring at all.
>> We currently use ignite without Spring Framework and, to make things
>> harder, under OSGi. As a part of exercise couple weeks ago I implemented
>> support for IoC [1] in environment we run. I did it by simulating
>> spring's ApplicationContext instance expected by IgnitionEx [2] and
>> GridSpringResourceContext.
>>
>> Turns out that Ignite IoC is fine with below API:
>> public interface BeanRegistry {
>> <T> T lookup(Class<T> type);
>> Object lookup(String name);
>> }
>>
>> Given that we look forward to keep use of Ignite I was asked to
>> contribute my work back to your project.
>> Would you be up to discuss, and if agreed, guide me on a shape of ioc
>> updates which would best fit Ignite itself? If you do not expect changes
>> in Spring integration then, maybe we could get a working solution within
>> ignite-osgi itself?
>>
>> Best,
>> Łukasz
>>
>> [1]
>> https://github.com/OpenNMS/horizon-stream/tree/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/resource
>>
>> [2]
>> https://github.com/OpenNMS/horizon-stream/blob/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/IgnitionFactory.java#L15

Re: Ignite support for IoC beyond spring framework

Posted by Данилов Семён <sa...@yandex.ru>.
Hi! 

This sounds like a good enhancement. Feel free to create a pull request!
As I see it, for now we should continue using SpringResource annotation (even if it injects non-spring resources), but at the same time create a new annotation (maybe something like @IgniteInject, I am bad with naming) and deprecate SpringResource annotation. Both annotations should work exactly the same.
Then we will have a spring version of injector interface and some generic version that any user can extend and use without spring.
WDYT?

P.S. You can create a JIRA ticket and mention me there, I'll be happy to review and merge your PR

Kind regards, Semyon.


> Hello,
> I would like to bring a proposal for Ignite to include support for
> @SpringResource without spring at all.
> We currently use ignite without Spring Framework and, to make things
> harder, under OSGi. As a part of exercise couple weeks ago I implemented
> support for IoC [1] in environment we run. I did it by simulating
> spring's ApplicationContext instance expected by IgnitionEx [2] and
> GridSpringResourceContext.
> 
> Turns out that Ignite IoC is fine with below API:
> public interface BeanRegistry {
> <T> T lookup(Class<T> type);
> Object lookup(String name);
> }
> 
> Given that we look forward to keep use of Ignite I was asked to
> contribute my work back to your project.
> Would you be up to discuss, and if agreed, guide me on a shape of ioc
> updates which would best fit Ignite itself? If you do not expect changes
> in Spring integration then, maybe we could get a working solution within
> ignite-osgi itself?
> 
> Best,
> Łukasz
> 
> [1]
> https://github.com/OpenNMS/horizon-stream/tree/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/resource
> 
> [2]
> https://github.com/OpenNMS/horizon-stream/blob/develop/minion/minion-taskset/taskset-worker/src/main/java/org/opennms/horizon/minion/taskset/worker/ignite/IgnitionFactory.java#L15