jPOS User Group super-member Victor Salaman this weekend posted news of a very useful advancement: "string interpolation and macro support for jPOS config files." Translation: Config files that can contain markup which would be resolved at runtime.
In the piece, Victor made things very relevant by using an example of a real-life TransactionManager transaction participant sequence that I've posted on my blog. You can see the original piece here.
As noted by Victor. we currently use substitution values that are resolved during build time. We have a properties file that looks like this (I've masked some of the details and thinned this out considerably for the blog post):
nodename = APP01
status-id = heartbeat1
status-name = Heartbeat 01
thales-status_0 = HSM_A_0
thales-status_1 = HSM_A_1
server-id = server1
logon-interval = 43200000
fdr0-delay = 60000
fdr1-delay = 5000
fdr0-monitor = FDR1 FDR Hagerstown 01
fdr1-monitor = FDR3 FDR Melville 01
amex0-monitor = AMEX1 AMEX IPC 01
amex1-monitor = AMEX3 AMEX NROC 01
saf-id = saf1 FDR SAF 01 Status
thales_0 = 10.99.2.88:1500
thales_1 = 10.99.2.88:1500
fdr0.host = 206.99.50.88
fdr0.port = 21999
fdr1.host = 206.99.50.88
fdr1.port = 21999
amex0.host = 148.99.39.77
amex0.port = 12777
amex1.host = 148.99.39.77
amex1.port = 12777
fdr.logon.space = jdbm:fdrlogon:log/fdrlogon
amex.logon.space = jdbm:amexlogon:log/amexlogon
lmk = cfg/test.lmk
bdk = cfg/test-bdk.cfg
debug = true
auditTrace = true
sessions.main=112
Now, in Victor's concept these things can get moved to runtime substitution for more flexibility. We have a 'main' TransactionManager that we currently start off like this in our SVN repository:
<main-txnmgr class="org.jpos.transaction.TransactionManager" logger="Q2">
<property name="sessions" value="@sessions.main@" />
<property name="space" value="tspace:default" />
<property name="queue" value="MAIN.TXN" />
<property name="debug" value="@debug@" />
In Victor's concept, you'd instead have a 'deploy-properties.ftl' like this:
[#-- ********* Transaction Manager properties ********* --]
[#assign tmSessions = '112']
[#assign tmDebug = 'true']
...and then:
<main-txnmgr class="org.jpos.transaction.TransactionManager" logger="Q2">
<property name="sessions" value="${tmSessions}" />
<property name="space" value="tspace:default" />
<property name="queue" value="MAIN.TXN" />
<property name="debug" value="${tmDebug}" />
I really the additional level of flexibility this approach provides us. It gives structure to our customers' change requirements in the occasional circumstances where they outstrip the pace of our normal release cycles.
Comments