Skip to Content
author's profile photo Former Member
Former Member

Error in Enhanced Receiver Determination - UDF

We have a requirement to determine the receivers of the message dynamically at runtime. From one of the blog I i got the how to do material.

I have created the receivers according to age.

<?xml version="1.0" encoding="UTF-8"?>

http://kj3.com">

<Person>

<Name>Kevin</Name>

<Age>28</Age>

</Person>

<Person>

<Name>Joseph</Name>

<Age>29</Age>

</Person>

</ns0:MT_Person>

this is the mapping program

//....................................................................................................................................................................................

public void Service(String[] age, ResultList result, Container container) throws StreamTransformationException{

int i;

int a1=0;

int a2=0;

int b[] = new int[10];

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

{

if(age.equals(ResultList.CC))

b<i> = Integer.parseInt(age<i>);

}

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

{

if(b<i><=25 && a1==0)

{

result.addValue("A1Service"); a1=1;

}

if( b<i>>25 && a2==0)

{

result.addValue("A2Service"); a2=1;

}

}

//...........................................................................................................................................

the program compiled successfully

but I am not able to see any thing in the receivers in the result window.

Please advice me

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 11, 2009 at 12:28 AM

    Hi Kevin,

    I may not fully understand what you need to do, but from what I can tell your UDF only needs the following:

    int a1=0;
    int a2=0;
    
    for(int i=0; i<age.length; i++) {
    
      int b = Integer.parseInt(age<i>);
    
      if(b<=25 && a1==0) {
           result.addValue("A1Service"); a1=1;
           result.addContextChange();
      } else if( b>25 && a2==0) {
           result.addValue("A2Service"); a2=1;
           result.addContextChange();
      } 
    
    }
    

    You will need to use your UDF in two places:

    1) Age --> UDF --> removeContext --> Receiver

    2) Age --> UDF --> Service

    Note: Set the context for Age to MT_Person for both of the above.

    -Russ

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.