JPOS/JPOSEE greenhorn : Rookie questions

118 views
Skip to first unread message

Nik

unread,
Apr 25, 2017, 11:30:12 PM4/25/17
to jPOS Users
Hi All,

I am a new JPOS/JPOSEE user and trying to understand its features for starting development with it.

This is what I have done as of now:

1) Cloned the master branch using https://github.com/jpos/jPOS-EE.git into my server repository
2) Cloned my master locally. This downloaded all source code under a root directory "jpos-ee"

Apart from other files, the "jpos-ee" directory has 3 directories viz. doc, gradle and modules.

I believe "modules" is the directory containing all the source code.

3) I ran "gradle eclipse" at "jpos-ee" directory. (I am new to gradle as well!!)

It threw out the following log lines for each directory inside "jpos-ee/modules":

:modules:client-simulator:eclipseClasspath
:modules:client-simulator:eclipseJdt
:modules:client-simulator:eclipseProject
:modules:client-simulator:eclipse

4) Imported generated eclipse projects into my eclipse.

This imported a total of 34 projects. While jpos-ee/modules has 33 modules. Cross-checking revealed that a "modules" project also got created with all the modules inside it.

So do I import only "modules" in eclipse ? Or is importing all 34 projects fine ?

========================================================================================================================================

Next I cloned jPOS-Template project and ran the following commands.

1) cd jPOS-Template
2) gradle eclipse (to import the project in eclipse)
3) gradle dist (which created a "distributions" directory inside "jPOS-Template/build" directory)
4) gradle installApp (which created a "install" directory inside "jPOS-Template/build" directory which had bin, deploy, lib, log directories and a jar file jPOS-Template-2.0.6.jar

Opened a command prompt. cd to "jPOS-template\build\install\jPOS-template" and ran:

java -jar jPOS-template-2.0.6.jar

This printed logs which I understand is ran "00_logger.xml and 99_sysmon.xml"

========================================================================================================================================

How do I proceed from this point onward ?
How do I start a Q2 server ?
How do I involve other modules in my projects ?
What will get deployed on my Production Server ? Is is just the jar ?

Thanks and Regards,
Nik









Alejandro Revilla

unread,
Apr 26, 2017, 4:31:23 PM4/26/17
to jPOS Users
Unless you're going to contribute to jPOS-EE, you don't actually have to clone it, you can just clone the jPOS template and add the dependencies you want.

Perhaps a good start is to launch the clientsimulator and serversimulator (see http://jpos.org/blog/2013/07/setting-up-the-client-simulator/)



This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/a37f003a-53c6-4837-9e7d-ffa5a2f8c9ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nik

unread,
May 1, 2017, 3:23:24 AM5/1/17
to jPOS Users
Hey Alejendro,

Thanks for your reply. Yes. That makes sense. No need to clone all modules.

However, I am confused about "hot deployment". What does that mean? How does it work?  Request you to read the details below:

I tried this and my setup is now this:

My ServerSimulator xml looks like this:

<server class="org.jpos.q2.iso.QServer" name="my_jpos_server" logger="Q2" realm="my_jpos_server">
 
   
<attr name="port" type="java.lang.Integer">9999</attr>
   
<attr name="maxSessions" type="java.lang.Integer">100</attr>
   
<attr name="minSessions" type="java.lang.Integer">0</attr>
 
   
<channel name="my_xml_Channel"
   
class="org.jpos.iso.channel.XMLChannel"
   
logger="Q2"
   
realm="my_xml_Channel"
   
packager="org.jpos.iso.packager.XMLPackager">
     
   
</channel>
 
   
<request-listener class="com.abc.jpos.server.ISOServerRequestListener">
       
<property name="timeout" value="10000" />
   
</request-listener>
</server>

So I have written my class ISOServerRequestListener  which is as follows:

public class ISOServerRequestListener implements ISORequestListener{
 
 
public boolean process(ISOSource source, ISOMsg message) {
 
try {
 message
.setResponseMTI();
 
System.out.println("I am here: " + message.toString());
 source
.send(message);
 
} catch (ISOException e) {
 e
.printStackTrace();
 
} catch (IOException e) {
 e
.printStackTrace();
 
}
 
return false;
 
}
}

So just getting the message and bouncing it up.

To kick off the system, I wrote a simple java class as below:

public class StartQ2
{
   
public static void main( String[] args )
   
{
    Q2 q2Server
= new Q2();
 q2Server
.start();
   
}
}


I created a distributable tar with main method of StartQ2 class as the entry point. 

The tar consists the following:

a) a log directory containing an empty file q2.log
b) a deploy directory containing xml files for logging, system monitoring and server simulator.
c) JAR file containing classes for StartQ2 and ISOServerRequestListener.

I exploded this tar in my unix system and ran the following command to bring system up:


java
-jar myjposjar.jar

This brings the server up and I am able to communicate with it through the designated port. 

Now what does hot deployment mean for me ?  

If I make some additions/enhancements (e.g. changing the server port in server simulator xml or changing the way messages are processed in ISOServerRequestListener class).
I will ofcourse create a new Tar file containing updated resource files and/or updated JAR file containing my java classes. 

If I explode the tar in my unix system, will my running Q2 server start reflecting the changes ? 
What does "deployment without bringing running jpos server down" mean in context of JPOS ? Can you please explain it using some example of changes to code. Or if you could point me to some resource explaining the concept. 

Thanks for reading!

Kind Regards,
Nik




To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

Alejandro Revilla

unread,
May 2, 2017, 4:10:41 PM5/2/17
to jPOS Users

The term hot-deployment in Q2 is used in two situations:

  • The ability to stop/start services just by editing its XML descriptor (in the deploy directory)
  • The ability to hot-deploy code in the deploy/lib directory that can be used by the QBeans

The latter has a limited use though and you usually have to know what you are doing. It is not a full fledged system such as OSGi (jPOS is quite OSGi friendly, so you can use an OSGi container and deploy jPOS as a bundle. or the other way around, use the --osgi switch to Q2 and have Q2 launch the OSGi framework.

The rationale behind adding the ability to deploy some jar in the deploy/lib and use it right away without having to bounce the system was to add the ability to hot-deploy some small fix to production, like an ISO filter until we find a good time to bounce the application.

So the rule of thumb here, if you want to write a filter, or deploy a small monitoring QBean, you can add the jar to deploy/lib. If you want something more sophisticated, with properly managed dependencies and life-cycle, go with OSGi.

Hope this helps.




Reply all
Reply to author
Forward
0 new messages