<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How to register my code that runs on every engine startup?</title><link>https://answers.axonivy.com/questions/2477/how-to-register-my-code-that-runs-on-every-engine-startup</link><description>&lt;p&gt;I have written a custom &lt;code&gt;ch.ivyteam.ivy.security.ISessionExtension&lt;/code&gt; so that I get informed whenever someone is authenticated on the Axon.ivy Engine. 
I need a mechanism to register this extension on every server startup so that I can be sure that the extension still works after a reboot of the engine. How can I do that?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/2477/how-to-register-my-code-that-runs-on-every-engine-startup" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 19 Nov 2018 06:31:14 -0500</lastBuildDate><item><title>Answer by Christian Strebel</title><link>https://answers.axonivy.com/questions/2477/how-to-register-my-code-that-runs-on-every-engine-startup/3552</link><description>&lt;p&gt;&lt;strong&gt;With 7.0 and higher:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You need to make an extension bundle / Eclipse plugin to extend the Engine / Designer.
How to do this see the &lt;a href="https://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.concepts.html#ivy-extension-eclipse"&gt;Concept chapter&lt;/a&gt; in the Designer Guide.
The Extension Point is still the same as before: &lt;a href="https://developer.axonivy.com/doc/latest/PublicAPI/ch/ivyteam/ivy/server/IServerExtension.html"&gt;ch.ivyteam.ivy.server.IServerExtension&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Christian Strebel</dc:creator><pubDate>Mon, 19 Nov 2018 06:31:14 -0500</pubDate><guid>https://answers.axonivy.com/questions/2477/how-to-register-my-code-that-runs-on-every-engine-startup/3552</guid></item><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/2477/how-to-register-my-code-that-runs-on-every-engine-startup/2478</link><description>&lt;p&gt;Follow these steps to attach your session listener when the engine starts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Move your ISessionExtension implementation into an own ivy-project that contains nothing but the extension&lt;/li&gt;
&lt;li&gt;Implement  an &lt;code&gt;ch.ivyteam.ivy.server.IServerExtension&lt;/code&gt; that can be used to start/stop your extension. Typically in here you register your code against a Manager of the ivy core engine.&lt;/li&gt;
&lt;li&gt;Convert your ivy-project into a PDE plugin project. Java Perspective -&amp;gt; Project context menu -&amp;gt; Configure -&amp;gt; convert to Plugin Projects&lt;/li&gt;
&lt;li&gt;Add a &lt;code&gt;META-INF/MANIFEST.MF&lt;/code&gt; file. &lt;/li&gt;
&lt;li&gt;Add the IServerExtension (will create a plugin.xml file in the root of the project). To do open the MANIFST.MF, tab 'extensions'  -&amp;gt; add -&amp;gt; IServerExtension&lt;/li&gt;
&lt;li&gt;Set your own ServerExtension as 'class' of the IServerExtension&lt;/li&gt;
&lt;li&gt;Export -&amp;gt; JAR -&amp;gt; include 'src, META-INF/MANIFEST.MF, plugin.xml' &lt;/li&gt;
&lt;li&gt;Put the JAR to your engine under &lt;code&gt;lib/patch&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Start the engine. The name of your extension should appear in the list of started services.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Environment&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;tested on Axon.ivy 6.5&lt;/li&gt;
&lt;li&gt;the simplified registration via extension point should work since Axon.ivy 6.1&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Sample project&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ivy project with SessionExtension and the ServerExtension: &lt;a href="/upfiles/SessionExtensionSample_65.iar"&gt;SessionExtensionSample_65.iar&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;compiled, exported JAR to run with an ivy engine: &lt;a href="/upfiles/SessionExtensionSample_65.jar"&gt;SessionExtensionSample.jar&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Screenshots:&lt;/strong&gt;
&lt;img alt="server extension implementation" src="http://answers.axonivy.com/upfiles/Java_-_SessionExt-src-ch-ivyteam-sample-SessionLifecycle.java_-_Axon.ivy_Designer__028.png"&gt;
&lt;img alt="manifest" src="http://answers.axonivy.com/upfiles/Java_-_SessionExt-META-INF-MANIFEST.MF_-_Axon.ivy_Designer__026.png"&gt;
&lt;img alt="extension point" src="http://answers.axonivy.com/upfiles/Java_-_SessionExt-META-INF-MANIFEST.MF_-_Axon.ivy_Designer__027.png"&gt;
&lt;img alt="engine output" src="http://answers.axonivy.com/upfiles/rew@zuglinrew_-media-rew-data-!axonIvyProducts-engine_53272_(eyo_before_65)-bin_025.png"&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Fri, 03 Mar 2017 10:16:40 -0500</pubDate><guid>https://answers.axonivy.com/questions/2477/how-to-register-my-code-that-runs-on-every-engine-startup/2478</guid></item></channel></rss>