Skip to main content

Q2 transient services

· 2 min read
Alejandro Revilla

In jCard and jPTS we use the concept of Stations, we have Source Stations (SS), Destination Stations (DS), Monitoring Stations (MS), Control Stations (CS) and Cryptographic Stations (HSMS), etc. Every station usually requires a handful Q2 services (QBeans), such as a MUX or MUXPool, one or more ChannelAdaptors with their filters, LogonManager, KeyExchangeManagers, eventually an independent logger, etc. You can configure those manually for a small set of stations, you can also use some scripts, but in order to support a large number of stations, and to easily manage them from the UI, we use a database to keep their basic configuration (station type, host, port, timeouts, etc.) and then use these new transient services provided by Q2. When Q2 starts, it's create an unique transient UUID, that FYI is displayed by the SystemMonitor task:

jPOS 1.6.9 r2950 e424833b-c2c1-4f8b-b743-8a69271912a2 00:00:00.170 ... ...

When you deploy a QBean using Q2's deployElement method (which is now public), you can flag that qbean as 'transient' (there's a boolean parameter). In that case, Q2 will remove the file on exit, but just in case the system crashes, it also adds a 'transient' attribute to the QBean, i.e:

... ...

The next time it runs, Q2 will generate a new instance ID, so in the rare situation where an old deployment descriptor is present in the deploy directory, it will be ignored and deleted (as it should have been removed at the previous exit). Q2.deployElement is a handy method that requires a JDom Element. If you are not a member of the JDom church, you can always create your QBean manually, you can get to know Q2's instance ID by calling its getInstanceId() method that gives you an UUID,. Note: when you deploy a bundle using Q2 --config=/path/to/your/bundle, Q2 now flags the exploded descriptors as transient. This is available as of jPOS 1.6.9 r2950