configuration.configurable andtransaction context

43 views
Skip to first unread message

ms great

unread,
Dec 30, 2021, 2:39:24 AM12/30/21
to jPOS Users
hi guys i just want to ask about configuration and configurable interface what they do and why we use them in class transction manger
and use cfg varible to save what data ?
and i want to ask what is transction context and id identifer and when they are created and thire life sycl

Andrés Alcarraz

unread,
Dec 30, 2021, 1:41:23 PM12/30/21
to jpos-...@googlegroups.com, ms great

Did you already read jPOS Programmer’s Guide?

Specifically section 3.3 and chapter 9 talk about what you asking, if you did, what part isn’t clear enough?

El 30/12/21 a las 02:39, ms great escribió:

hi guys i just want to ask about configuration and configurable interface what they do and why we use them in class transction manger
and use cfg varible to save what data ?
and i want to ask what is transction context and id identifer and when they are created and thire life sycl
--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/2b52fe4f-3db6-4f3a-b647-839a87c05005n%40googlegroups.com.

--
________________________________________
Andres Alcarraz - Senior Developer | Transactility, Inc. | Lima, Perú | e: a...@transactility.com | sk: alcarraz1976



ms great

unread,
Dec 31, 2021, 1:16:05 AM12/31/21
to jPOS Users
hi there thank you for your response
and to start i read the programming guide many time and all i found that configration is a container (i didnt know continer for what ) and i have basic information in java programing and never concted to aserver so configration is a conspet i never knew so i hope you give me an information about what data we are configer and why we but them in cfg varible and what is transction context plz explain them to me because i read the guid and still cant figra it out 

ms great

unread,
Dec 31, 2021, 3:13:35 AM12/31/21
to jPOS Users
and i didnt uderstand this note in section 3.3 from the guide 

i didnt uderstand what yml , ${xxx and where use it in jpos

SimpleConfiguration recognizes and de-references properties with the format: ${xxx} and searches for a system property, or operating system environment variable under the xxx name. As a fallback mechanism of last resort, the property can be resolved from an environment file, in YAML or properties file syntax, found in the cfg directory (default filename default.yml or default.cfg, which can be overridden by the jpos.env system property).

You can add a default value within the expression itself, using the : (colon) separator. For example ${xxx:def_value}. If the property is not found, the default value will be used.
The format $sys{xxx} de-references just from system properties, $env{xxx} just from the operating system environment, and $cfg{xxx} just from the environment file (the.
In the rare case where a value with the format ${...} is required, the $verb{${...}} format (verbatim) can be used.
In addition, a property named xx.yy.zz can be overridden by the environment variable XX_YY_ZZ (note that dots are replaced by underscore, and property name is converted to uppercase.

On Thursday, December 30, 2021 at 9:41:23 PM UTC+3 a...@transactility.com wrote:

murtuza chhil

unread,
Dec 31, 2021, 6:32:03 AM12/31/21
to jPOS Users
Your deploy qbean may need some configurable data/arguments

e.g.

<anyStringName class="x.y.z.MyQbean" logger="Q2">
<property name="myProperty" value="ABCD" />
</anyStringName>

When this bean is deployed, jpos q2 calls methods like initservice and startservice. If MyQbean implements Configurable, the setConfiguration method is called with the Configuration object passed in.
From this configuration object you can do a cfg.get("myProperty"). this will return the property value configured i.e. ABCD.

If you need to access system properties or environment variables you can access that using the $ style.
So if in the above example I could put the value as ${xxx} where xxx is a system/environment property and getting myProperty will result in the value stored in your environment under xxx.
If ${xxx} cannot be found in the system or environment variables, a lookup is done in the cfg directory in a file called default.yml or default.cfg, which can be overridden by the jpos.env system
property.

If ${xxx} is not found but you want to default it to a value, you need to use the format ${xxx:ABCD}, so it defaults to ABCD.



Transaction context is an instance of Context.java that is passed around to every participant in your transaction manager. Treat it like a hashmap to store name value objects that can be utilized by participants anywhere.
There is a PrepareContext participant that one calls at the beginning of the txn mgr that creates the context and is assigned to the Serializable passed in. Now every participant following this one gets the context and can be used to access values setup by previous participants or store new name value pairs by the current participant.
A good example is the ISOMsg that you received, its put in the context.

-chhil



Andrés Alcarraz

unread,
Dec 31, 2021, 8:39:26 AM12/31/21
to jpos-...@googlegroups.com

I suggest you go through the tutorials, the first two will do.

Just follow them, step by step trying to understand them, it should all be clear to you after finishing them.

I wouldn’t worry right now about the ${xxx} format, consider advanced usage and come back to that if you think you will need it after you have the basic concepts.

El 31/12/21 a las 03:13, ms great escribió:

and i didnt uderstand this note in section 3.3 from the guide 

i didnt uderstand what yml ,${xxx and where use it in jpos


SimpleConfiguration recognizes and de-references properties with the format: ${xxx} and searches for a system property, or operating system environment variable under the xxx name. As a fallback mechanism of last resort, the property can be resolved from an environment file, in YAML or properties file syntax, found in the cfg directory (default filename default.yml or default.cfg, which can be overridden by the jpos.env system property).

You can add a default value within the expression itself, using the : (colon) separator. For example ${xxx:def_value}. If the property is not found, the default value will be used.
The format $sys{xxx} de-references just from system properties, $env{xxx} just from the operating system environment, and $cfg{xxx} just from the environment file (the.
In the rare case where a value with the format ${...} is required, the $verb{${...}} format (verbatim) can be used.
In addition, a property named xx.yy.zz can be overridden by the environment variable XX_YY_ZZ (note that dots are replaced by underscore, and property name is converted to uppercase.

On Thursday, December 30, 2021 at 9:41:23 PM UTC+3 a...@transactility.com wrote:

Did you already readjPOSProgrammer’s Guide?

Specifically section3.3 and chapter 9 talk about what you asking, if you did, whatpart isn’t clear enough?

El 30/12/21 a las02:39, ms great escribió:

hi guys i just want to ask about configuration andconfigurable interface what they do and why we use them inclass transction manger
and use cfg varible to save what data ?
and i want to ask what is transction context and ididentifer and when they are created and thire life sycl
--
--
jPOS is licensed under AGPL - free for community usage foryour open-source project. Licenses are also available forcommercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to theGoogle Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails fromit, send an email to jpos-users+...@googlegroups.com.
--
________________________________________
AndresAlcarraz - Senior Developer | Transactility, Inc. | Lima, Perú | e: a...@transactility.com | sk: alcarraz1976



--
--
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.
Reply all
Reply to author
Forward
0 new messages