on 08-09-2009 12:44 AM
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"?>
<ns0:MT_Person xmlns:ns0="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<i>.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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.