Hi guys.
How can get I field list from nChannel object using Java API?
The channel was created during sync from webMethods, I need to know name and type of fields to pass to nEventProperties constructor.
I call nSession.getChannel(“wm::is::MyPackageName::DocumentName”) and get nChannel object, all is ok
however all getters like getAttributes().getMedatada() return null or empty arrays.
Could you help me? I can’t find any example of the code
Hi Alexander,
the use-case you are describing is not directly supported or tested, so there is no easy answer.
You should be able to get the protobuf descriptor (probably a byte array) from the channel attributes and use that to construct a message.
But if the data you want to pass in from an external client is quite simple (not hierarchical), then you could consider changing the IS doc type’s encoding from Protobuf to IData. Then put a top-level doc inside the doc type called _properties and then put any number of string values inside _properties.
Now, your external client can send that data as dictionary fields in the UM message. So if you have a field in the IS doc type _properties/country, then you set a dictionary field call country and it should show up where you want it to.
Hope this helps.
Hi Jonathan, thanks for the answer.
I’ve tried
channel.getChannelAttributes().getProtobufDescriptorNames() and
channel.getChannelAttributes().getProtobufDescriptorSets()
both methods return null.
Some of data are hierarhical, some are not.
However my issue is how to know the name of a field, how to determine if IS doc type has a dictionary field “country”, and what other fields, if any. May be I can use some webMethods services to get a document structure by document name?
First of all, can you check that your IS doc type has encoding set to Protobuf? If not, set it to Protobuf and resync.
Then you might be able to get the protobuf descriptor.
For using IData encoding and _properties, there is no metadata in UM that you can introspect.
Thanks Jonathan, this helps, I got protobuf descriptor.
However, there are a lot of documents, and it will take too much time to change them manually. I suppose I can get this information from webMethods service/change and resync data using some code.
Don’t you know what package can I look into? Or it will be better to create a new topic in webMethods section?
If you need to bulk change the encoding from IData to Protobuf, you could run the service pub.utils.messaging:migrateDocTypesTriggersToUM (documented in the IS built-in services guide), passing in a list of doc types or packages. It was designed to help with Broker-to-UM migration, but one of the things it does is change encoding to protobuf.