restart service via service proxy

classic Classic list List threaded Threaded
2 messages Options
mvolkomorov mvolkomorov
Reply | Threaded
Open this post in threaded view
|

restart service via service proxy

Hello!

I used a custom bean with properties for kafka streamer service at ignite config.xml:
 
   <bean id="kafkaConsumerProperties"
          class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="singleton" value="true"/>
        <property name="properties">
            <props>
                <prop key="bootstrap.servers">localhost:9092</prop>
                <prop key="auto.offset.reset">latest</prop>
                <prop key="enable.auto.commit">true</prop>
                <prop key="group.id">ignite-consumer-group</prop>
                <prop key="key.deserializer">org.apache.kafka.common.serialization.StringDeserializer</prop>
                <prop key="value.deserializer">org.apache.kafka.common.serialization.StringDeserializer</prop>
            </props>
        </property>
    </bean>

Injected this bean using:
@SpringResource(resourceName = "kafkaConsumerProperties")
    private transient Properties kafkaConsumerProperties;

I have an ignite service with a custom REST API (Jersey).
I am trying to implement an ignite service method that can restart another ignite service via ignite serviceProxy.
Calling this method at REST API:

class RESTController {

// some REST method signature here
Ignite ignite = Ignition.ignite();
RESTService restService = ignite.services().serviceProxy(RESTService.SERVICE_NAME,
            RESTService.class, false);

restService.restartMyService("myServiceName");
}
}

public class RESTServiceImpl implements RESTService {

public void restartMyService(String serviceName) {

ignite.services().cancel(serviceName);
ignite.services().deployNodeSingleton(serviceName, new KafkaConsumerService());
}
}

My error at method call:

[2020-07-28 14:58:32,123][ERROR][services-deployment-worker-#70][IgniteServiceProcessor] Failed to initialize service (service will not be deployed): KafkaCDRConsumerServiceorg.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'kafkaConsumerProperties' available

I believe that deployNodeSingleton() can't see @SpringResource injection. I guess that proxyService calls operated at Ignite context. What are the reasons? Is there a way to restart my service with injections?
akurbanov akurbanov
Reply | Threaded
Open this post in threaded view
|

Re: restart service via service proxy