start jposserver using q2 command line cli

383 views
Skip to first unread message

Amit Vadje

unread,
Apr 13, 2017, 2:06:52 AM4/13/17
to jPOS Users
Hi,

I have created one sample jposserver application which will listen on port. I like to start this application using bin/q2 -cli command line utility.

Can you please help me about this? how can I start it and monitor the process using bin/q2 command line?



Thanks,
Amit

chhil

unread,
Apr 13, 2017, 11:02:51 PM4/13/17
to jpos-...@googlegroups.com

--
--
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/fc480c34-f9c7-47b1-a3f8-aa99f25ce6a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Amit Vadje

unread,
Apr 14, 2017, 1:05:24 AM4/14/17
to jPOS Users
Hi Chhil,

Thanks a lot for sharing this link which is very informative.

I like to ask you that suppose I have created 2 jpos server and both will be listening on 2 different port. If i deployed .xml file in deploy directory q2 automatically reads and start those servers. In this case, how can i start explicitly start/stop those 2 servers using CLI command line eg. "q2>start server1 or q2>start server2"?


Thanks,
Amit


On Friday, 14 April 2017 08:32:51 UTC+5:30, chhil wrote:
On Thu, Apr 13, 2017 at 11:36 AM, Amit Vadje <vadj...@gmail.com> wrote:
Hi,

I have created one sample jposserver application which will listen on port. I like to start this application using bin/q2 -cli command line utility.

Can you please help me about this? how can I start it and monitor the process using bin/q2 command line?



Thanks,
Amit

--
--
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+...@googlegroups.com.

chhil

unread,
Apr 14, 2017, 1:50:33 AM4/14/17
to jpos-...@googlegroups.com

I have created one sample jposserver application which will listen on port


It needs to be a qbean with an xml descriptor.

e.g.

<?xml version="1.0" ?>
<server name="my-server" class="org.jpos.q2.iso.QServer" logger="Q2">
  <attr name="port" type="java.lang.Integer"> listening port number</attr>
  <channel name="my.channel"
          class="org.jpos.iso.channel.NACChannel"
          packager="org.jpos.iso.packager.GenericPackager" logger="Q2">
     <property name="packager-config" value="cfg/my_packager_file.xml" />
     <property name="timeout" value="1000000" />
  <request-listener class="my.request.listener.implementation.class" logger="Q2" realm="incoming-request-listener">

  </request-listener>
</server>
When Q2 is run, it checks the deploy folder for xml file, reads them and instantiates objects.
In the above case, it will start a tcp server listening on a port specified in the configuration.
You give it a channel class that knows how to handle any headers (things like length/tpdu etc) preceding your ISOMsg. It reads and extracts the raw  ISOMsg data , uses the packager configured in the xml to to unpack the message into an ISOMsg object  and gives it to your class that implements ISORequestListener ibterface. There you do whatever you want to with message in the

public boolean process (ISOSource source, ISOMsg m)

and use the source to respond back.

-chhil

chhil

unread,
Apr 14, 2017, 2:02:56 AM4/14/17
to jpos-...@googlegroups.com


>In this case, how can i start explicitly start/stop those 2 servers using CLI command line eg. "q2>start server1 or q2>start server2"

You cant start and stop components that way or atleast I am not aware of it.
You can undeploy a xml by renaming its extension which will stop the server. This can be done using the -cli
of ENABLE and DISABLE
(
https://github.com/jpos/jPOS/tree/master/jpos/src/main/java/org/jpos/q2/cli/deploy)

-chhil

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.

Amit Vadje

unread,
Apr 14, 2017, 3:00:16 AM4/14/17
to jPOS Users
Hi Chhil,

Thanks a lot for this information. So there is no way to start explicitly using command line.

If we have 2 separate qbean and those are deployed using xml. So how many JVM processes will be running for it? will it be only one jvm process which is actual jpos process or 2 different jvm process? How will it be monitor respective to how many request has been processed and pending to process?


Thanks,
Amit

chhil

unread,
Apr 14, 2017, 3:26:34 AM4/14/17
to jPOS Users

I am not aware if there is an explicit way.

Everything under your deploy folder is run under one JVM, q2 instantiates all your components.
The channel has counters for requests responses.
If you deploy the system monitor beam you will get the counters displayed or you can may be do it via cli.
You can get components from the nameregistrar and use the getter methods to get counts too.

-chhil


Alejandro Revilla

unread,
Apr 14, 2017, 10:33:48 AM4/14/17
to jpos-...@googlegroups.com
There's an explicit way usin CLI and the deploy subsystem. (Type deploy from the command line)


For more options, visit https://groups.google.com/d/optout.
--

Amit Vadje

unread,
Apr 14, 2017, 12:21:34 PM4/14/17
to jpos-...@googlegroups.com
Hi Alessandro, 
Can you please explain more details related to this?  As I like to start and stop jposservers using click command like "start/shutdown  server1 or start/shutdown"  server2



Thanks, 
Amit

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/5fc77ebf-d639-44af-8d85-bbf7aa0eedba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
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.
--

--
--
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 a topic in the Google Groups "jPOS Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jpos-users/sAT8S3_QjYE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.

Alejandro Revilla

unread,
Apr 14, 2017, 6:23:59 PM4/14/17
to jPOS Users

There are many ways to start and stop services from the command line. The easiest way is to start Q2 as a service (by calling bin/start) and then rename the service descriptors in the deploy directory from .xml to .off to turn them off, or from .off to .xml to turn them back on. (.off is an arbitrary file extension, anything not xml would take the same effect).

If you want to start Q2 interactively using q2 --cli, then you can go to the deploy subsystem by typing deploy. (type tab to see available commands). You can list services and enable/disable them. You can run q2 --cli in the foreground, or you can run q2 --ssh and then “ssh” to your running Q2 to run those commands.

Please note that when you run q2 --cli the default deploy directory is actually deploy-cli. You can override that by also using the --deployDir switch. Try q2 --help to see

​the
 available options.




Reply all
Reply to author
Forward
0 new messages