Convert IData into BrokerEvent

Hi all,

I want to publish a document using an external java client without going throught an IS, by that I mean I want to use the BrokerClient class in order to directly connect to the Broker.

The publish methods signature of the BrokerClient class is “void publish(BrokerEvent event)”. The problem that I am facing is that I have built an IData and not an Event and I cannot find how to build an Event from using my IData.

Do you have a piece of code that I can use as an example?

In advance, thank you.

Have you investigated changing the code to build a BrokerEvent instead of IData? The steps are very similar.

yes it is possible, so my event should have the same structure as the Document Type so that the existing Broker client pick it up form its queue.

I am not really familiar with the Broker API, that’s why I started working with IData, and than noticed that I need to build an event for the publish method.

Can you please point me on the appropriate methods, or maybe do you have a piece of code I can use as an example to build an event that will contain a String field and a Document that contains 2 String fields for example ?

In advance, thaks for your help on this.

Documentation and examples for the Broker API are delivered together with the Broker installation and can be found in the Broker installation directory. I used the examples there myself and think they are sufficient for creating broker clients in C or Java.

Hello,

I am facing the similar issue. I have a broker event containts structure type.I need to use the BrokerEvent.setStructFieldFromEvent method to convert the IDATA to broker event. Does any one know? earlier we have the methods fromObject but it is deprecated. If any one has sample code can you please post?

-Sai

Hi,

I have written the attached code sometime back. Hope its useful for you.

P.S.: To be able to attach the file, I have changed its extension to ‘txt’. Please change it to ‘java’.

Regards,
Hemanth
CanonicalToBrokerEvent.txt (2.47 KB)

Thanks a lot Hemanth for code to convert IData to BrokerEvent. Its working perfectly and I have updated only few things in same code.
Updated not to use “Class ValuesEmulator” and updated code to handle String List and String separately.

Best Regards,
Uday
IDataToBrokerEvent.txt (3.32 KB)