How Ignite launch the ./libs Jar

classic Classic list List threaded Threaded
9 messages Options
marble.zhong@coinflex.com marble.zhong@coinflex.com
Reply | Threaded
Open this post in threaded view
|

How Ignite launch the ./libs Jar

Hi , need your help, or give a link, or give a hint on this deployment,

Ignite Jar deployment case,

Say I have a jar package with the main-class defined, and put it into the
./libs folder, what will the ignite do, ignite how to launch this Jar? Which
is the endpoint for Ignite launch this Jar?

Any specification for the Jar to the ./libs, btw , is there a full example
of the userversion xml of ignite.xml, if put below content into the
ignite.xml, ignite shows cannot recognize the userVersion tag,


<bean id="userVersion" class="java.lang.String">
    <constructor-arg value="0"/>
</bean>

my problem is don't know what ignite launch this Jar, I expect ignite can
help launch the Jar main-class, and monitoring the cache put event, and it
will fire the compute/tasks. And which is a loop forever.

Thanks a lot.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
akorensh akorensh
Reply | Threaded
Open this post in threaded view
|

Re: How Ignite launch the ./libs Jar

Hi,
   If you are using a regular downloaded version then:
    When you put a jar into the libs dir it will be automatically located in
the classpath.
    You can then do jinfo <pid> and find your jar.  Use any class within
that jar inside your app and it should work.

   you can do an experiment:
   go into the libs dir and do: touch myfile.jar
   then start ignite using ignite.sh/ignite.bat

   find your java process (use jps -v) then run jinfo <pid> | grep
myfile.jar

   Send your config file/logs and I'll take a look.


Thanks, Alex



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
marble.zhong@coinflex.com marble.zhong@coinflex.com
Reply | Threaded
Open this post in threaded view
|

Re: How Ignite launch the ./libs Jar

thanks a lot Alex.

I saw my jar from the java process. But cannot see the logs I print out from
the ignite console, I am not sure whether the task run or not run,

My META-INF/ignite.xml defined as below,

<?xml version="1.0" encoding="UTF-8"?>



<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
    <description>Ignite Spring configuration file in gar-file.</description>

   
    <util:list id="tasks">
        <value>com.coinflex.ComputeTaskDeployment</value>
   </util:list>
</beans>

And the task ComputeTaskDeployment is simple as below,

public class ComputeTaskDeployment extends ComputeTaskSplitAdapter<String,
Integer> {

        @IgniteInstanceResource
        Ignite ignite;

        public ComputeTaskDeployment() {
            System.out.println("starting the ComputeTaskDeployment sample");
        }



        @Override
        protected Collection<? extends ComputeJob> split(int clusterSize,
String arg) {
            Collection<ComputeJob> jobs = new LinkedList<>();

            arg = "how many words there.";


            for (final String word : arg.split(" ")) {
                jobs.add(new ComputeJobAdapter() {
                    @Nullable @Override public Object execute() {

                        // Return number of letters in the word.
                        int len = word.length();
                        System.out.println(">>> Printing '" + word + "'
length is:" + len + " on this nodeID "
                                + ignite.cluster().localNode().id() + " from
ignite job.");
                        return len;

                    }

                });
            }

            return jobs;
        }


        /** {@inheritDoc} */
        @Nullable
        @Override
        public Integer reduce(List<ComputeJobResult> results) {
            int sum = 0;
            System.out.println("reduce start...");
            for (ComputeJobResult res : results)
                sum += res.<Integer>getData();

            return sum;
        }
    }


thanks again Alex




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
marble.zhong@coinflex.com marble.zhong@coinflex.com
Reply | Threaded
Open this post in threaded view
|

Re: How Ignite launch the ./libs Jar

In reply to this post by akorensh
Can I understand the task deployment like this:

package jar to ./libs, Ignite only will load this class into instance, but
will not trigger that, task will only trigger by outside the ignite client
or jdbc or jmx?

In this case, outside programmer only need to know the taskName, and call
this task directly?
But if so, how to pass the parameter to this task?

Best if with samples, thanks a lot.




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: How Ignite launch the ./libs Jar

Hello!

For example, method 'compute' has last argument as 'T arg' which is passed to task.


Regards,
--
Ilya Kasnacheev


чт, 21 мая 2020 г. в 10:06, [hidden email] <[hidden email]>:
Can I understand the task deployment like this:

package jar to ./libs, Ignite only will load this class into instance, but
will not trigger that, task will only trigger by outside the ignite client
or jdbc or jmx?

In this case, outside programmer only need to know the taskName, and call
this task directly?
But if so, how to pass the parameter to this task?

Best if with samples, thanks a lot.




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
marble.zhong@coinflex.com marble.zhong@coinflex.com
Reply | Threaded
Open this post in threaded view
|

Re: How Ignite launch the ./libs Jar

Thanks a lot Ilya.

My confusion is, where to fire the task, does Ignite will help launch this
task when startup the ignite instance?

I have tried, but not found any logs output.
If ignite cannot help launch, only load the class into memory, then where to
fire/trigger this tasks? need a separate client to launch it?

If ignite can help start the task, how to, can help review my ignite.xml and
point out the incorrect settings?

Thanks a lot.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: How Ignite launch the ./libs Jar

Hello!

You can configure Ignite to automatically register service on start-up or call lifecycle listener:

Regards,
--
Ilya Kasnacheev


чт, 21 мая 2020 г. в 15:28, [hidden email] <[hidden email]>:
Thanks a lot Ilya.

My confusion is, where to fire the task, does Ignite will help launch this
task when startup the ignite instance?

I have tried, but not found any logs output.
If ignite cannot help launch, only load the class into memory, then where to
fire/trigger this tasks? need a separate client to launch it?

If ignite can help start the task, how to, can help review my ignite.xml and
point out the incorrect settings?

Thanks a lot.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
marble.zhong@coinflex.com marble.zhong@coinflex.com
Reply | Threaded
Open this post in threaded view
|

Re: How Ignite launch the ./libs Jar

thanks Ilya, lifecyclebean just verified works.
Can you share the "configure Ignite to automatically register service"
related links? thanks.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: How Ignite launch the ./libs Jar

Hello!

Please check the IgniteConfiguration.setServiceConfiguration() method.

Regards,
--
Ilya Kasnacheev


чт, 21 мая 2020 г. в 15:55, [hidden email] <[hidden email]>:
thanks Ilya, lifecyclebean just verified works.
Can you share the "configure Ignite to automatically register service"
related links? thanks.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/