cancel
Showing results for 
Search instead for 
Did you mean: 

user defined function coding

Former Member
0 Kudos

hi friends,

i want to put a user defined function for sending the data into multiple receivers.. in that function i need to write the simple coding like.. if the source data is not null then moves data into all the receivers..

for example see my coding..

-


int i;

for(i=0; i<a.length;i++)

{

if( !a.equals(" ") )

{

result.addValue("RECEIVER1" );

result.addValue("RECEIVER2" );

result.addValue("RECEIVER3" );

}

}

-


but this is not working fine.. because.. data will moves into one receiver only only.. SO, PLZ CORRECT THIS.. AND SEND ME THE EXACT CODING..

THANKS

BABU>

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Babu,

Why can't you use receiver determination in the integration directory ? This is what it is for.

I cannot see why you would need to use a UDF to send a message to multiple receivers.

Please explain - I'm confused.

Cheers

Colin.

former_member192892
Active Contributor
0 Kudos

Babu,

You must be using the Receivers message type if i'm correct.

In this message type, the occurence of the Receiver tag is 0--unbounded and the occurence of service is 1.

So in this case the code

result.addValue("RECEIVER1" );

result.addValue("RECEIVER2" );

result.addValue("RECEIVER3" );

won't work for service node in the output.

modify the code in this way

result.addValue("RECEIVER1" );

result.addValue(ResultList.CC);

result.addValue("RECEIVER2" );

result.addValue(ResultList.CC);

result.addValue("RECEIVER3" );

Please test your mapping first with a sample payload...

Also please give the source payload structure with occurence if you can here

Former Member
0 Kudos

Hi

use this you have to declare the i as 0

int i=0 ;

for(i=0; i<a.length;i++)

{

if( !a.equals(" ") )

{

result.addValue("RECEIVER1" );

result.addValue("RECEIVER2" );

result.addValue("RECEIVER3" );

}

}

and if you want to the multiple receivers then you can use the configured receivers in the receiver determination.in that based on the condition you can send to different receivers..

if you still have the problem please reply me back

Thanks

Rinku

Former Member
0 Kudos

BABU,

I guess there is no need to write any UDF, only for checking null data you can validate it mapping very easily. and once you validate it you will get the data.

Sending to many receiver can be handled in RECEIVER DETERMINATION.

If I have not understood your point, plz explain me with your requirement in detail.

Regards,

Sarvesh

Former Member
0 Kudos

Hi,

Set the context of the source node to the very very first parent node of your source message.

It will work.

Regards,

AKshay.

    • Reward points if find useful.