Find all doctypes being published using publish.publish

Hi, I’m trying to compile a list of all the doctypes that are being used with WMPublic.pub.publish:publish to be published to the Broker and how many services publish each doctype.

I can find the list of services calling a dependent search - is there are an easy way to compile the list of doctypes which are serving as input to the component?

Would also like the complete list of doctypes to compare.

Thanks

Hi Alec,

One way I can think of achieving this is by doing a find references on each of the list of services found using pub.publish:publish service.

Regards,
Ashok

Hi Alec,

you can try to retrieve the List of Publishable DocTypes from Broker by using Broker JavaAPI.
You will have to filter the list on your custom DocType Names as there quite a lot system defined publishable DocTypes too.

Loop of the list and check their dependent objects.

Please note the special naming format for the DocTypes on the Broker, which needs to be transformed into the standard IS format.

Can you explain the business case behind your request, please?
Sounds very uncommon.

Regards,
Holger

Also kindly check if you find some services in WmRoot package. I assume there should be one, I will keep you updated if I find it.

Yes WmRoot or WmART services would be the best bet to find services that does behind the scenes.

HTH,
RMG

Unfortunately, there isn’t a way out-of-the-box to do what you want. You either have to write some Java code to leverage the IS internal API or you have to write some code to traverse through the flow.xml files and compile this information.

Just out of curiosity, I wanted to see how easy it would be to do the latter. So here’s a sample PowerShell script I threw together. I apologize for the lack of comments but if your packages are available on a Windows machine, give it a try. I ran it using PowerShell v4, by the way.

This should give you back the service name, the document being published, and the publish step’s comment:

Param(
    $packagesDir = 'C:\SoftwareAG\IntegrationServer\instances\default\packages'
)
$packages = Get-ChildItem -Path $packagesDir -Directory | ? {$_.name -notlike 'Wm*' -and $_.name -ne 'Default'}
foreach($p in $packages) {
    $flows = Get-ChildItem -Recurse -Path $p -Include flow.xml
    foreach($f in $flows) {
        try {
            $xml = [xml](Get-Content $f)
            $publishes = $xml.SelectNodes("//INVOKE[@SERVICE='pub.publish:publish']")
            $nsPosition = $f.FullName.IndexOf('\ns\')
            $service = $f.FullName.Substring($nsPosition + 4).Replace('\flow.xml', '').Replace('\','.') -replace "(.*)\.(.*)", '$1:$2'
            foreach($p in $publishes) {
                $document = (($p.MAP | ? MODE -eq 'INPUT').MAPSET | ? FIELD -like '*documentTypeName*').DATA.Values.value.'#text'
                New-Object -TypeName PSObject -Property @{Flow = $service; Document = $document; Comment = $p.COMMENT}
            }
        }
        catch {
            Write-Error "Error processing ($f): $_"
        }
    }
}

Percio

Thanks all for the responses. Yeah I did not find any functionality which would help in any of the Wm packages, so I was looking at going through the flow.xml files and had some good results using XQuery tools.

Percio, great answer, thanks a lot. I didn’t realise Powershell had such rich xml parsing. Will definitely make use of some of that. :slight_smile:

Business case for us is assessing the options with Broker EOL approaching. We’re gauging the scale of the work required to migrate to using generic JMS messaging if we decided not to go for the Universal Messaging path.

Check wm.broker.sync:list will all the publishable doc types.

Mahesh,

The challenge is not getting a list of publishable document types but a list of services publishing specific document types.

Percio

Hi,

in general you are right.

But keep the following in mind:
When having a list of publishable DocTypes, you can loop over these and check for services which are publishing them.

DocTypes for AdapterNotifications are usually not published by pub.publish:publish explicitly, but they are published by ART implicitly.

Regards,
Holger

True but the question was specific to “list of all the doctypes that are being used with WMPublic.pub.publish:publish”

Sure.

But what about the following scenario:
Having a list with available publishable DocTypes you can create a list of services which are using these DocTypes.
On the other side create a list of services which are using publish, publishAndWait and reply.

When a service is listed in both lists, in most cases this service publishes one of the doctypes.

Then you will only have to check these services for the publish step which DocType is published here.

Some Pseudo code:


find dependends for pub.publish:publish (List1)
find dependends for pub.publish:publishAndWait (List1)
find dependends for pub.publish:reply (List1)
get List of Publishable DocTypes from Broker
LOOP
  find dependends for DocType (List2)
compare the 2 lists for services being present in both (List3)
LOOP
  check each member if List3 for the details of the pub.publish:*-invoke step

Regards,
Holger