In OSB there's no such thing as side-by-side support of versions and also you can't see what particular version of a OSB Configuration is deployed.
Since I was asked several thimes by project managers to denote different versions of a particular service in different releases I came up with a very simple solution.
First I defined an xml schema, like the following:
<?xml version="1.0" encoding="UTF-8" ?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xmlns.darwin-it.nl/CDM/xsd/V1/SVC/VersionInfo" xmlns:ver="http://xmlns.darwin-it.nl/CDM/xsd/V1/SVC/VersionInfo" elementFormDefault="qualified"> <xsd:element name="VersionInfo" type="ver:versionInfoType"> <xsd:annotation> <xsd:documentation>Version info</xsd:documentation> </xsd:annotation> </xsd:element> <xsd:complexType name="versionInfoType"> <xsd:sequence> <xsd:element name="versionNr" type="xsd:string"/> <xsd:element name="versionDate" type="xsd:string"/> <xsd:element name="author" type="xsd:string"/> <xsd:element name="change" type="xsd:string"/> <xsd:element name="svnId" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema>In my setup this xsd is placed in a separate shared xsd-project.
Then in the root of each OSB Service-project I place an xquery file as follows:
xquery version "1.0" encoding "UTF-8"; <ver:VersionInfo xmlns:ver="http://xmlns.darwin-it.nl/CDM/xsd/V1/SVC/VersionInfo"> <ver:versionNr>1.50.01</ver:versionNr> <ver:versionDate>2014-09-17</ver:versionDate> <ver:author>M. van den Akker</ver:author> <ver:change>ChangeNr - Particular change</ver:change> <ver:svnId>$Id: versie.xq 1520 2014-09-17 10:25:29Z makker $</ver:svnId> </ver:VersionInfo>This xquery is nothing more than an xml-file with an xquery-prolog, a trick you can use to externalise hardcoded properties from your proxy-services. So it doesn't have input and output variable declarations. You could replace certain fields like versionNr with ant-properties to replace it during an ant deployment. In my current setup I change it by hand when commiting the changes in Subversion.
In my proxyservices at the 'entry points' of the services, the start of the first stage in the message flow, I add an assign and an alert. In the Assign the xquery is executed to a versionInfo variable:
Then an alert is added to have the version info shown after the call of the service. This way you can see with what version of the service the request is handled:
The expression of the alert is:
concat('Version: ',$versionInfo/ver:versionNr,', date: ',$versionInfo/ver:versionDate)This is where the xsd comes along, because to help you enter this expression, but especially to get this valid (to get the namespace added), you must add the versionInfo element of the xsd as the versionInfo variable. You could also add the namespace manually, but adding the variable structure is more convenient.
This alert is actually optional, but can be usefull when debugging, investigating services and service executions. The xquery resides after deployment on the OSB Server and can be reviewed using the Project Explorer in the Servicebus console. It can be hard for the system-administrator to conclude from script output if a deployment succeeded. The comparison of the versionInfo.xq on the OSB with the version in a release-document that you deliver with your deployment can help him out. OSB commits the deployment as a whole, so the correct version-number in the versionInfo.xq file indicates a successfull deployment.
Another trick you could notice in the screendump is that I use a seperate alert destination for development/debug messages. I found that you can't set the loglevel on an alert. You need to do that on each proxyservice in a compound service configuration. Because I found that very inconvenient, I added a seperate alert destination for debug messages. On acceptance and/or production you can switch of the logging of debug messages on that particular destination.
No comments:
Post a Comment