Hi guys,

I suspect a bug in one of the classes.  I am not sure where the bug is but 
I'll dig more and I'll find it

I have the following code

        OutboundMessage msg = new OutboundMessage();
        String da1="+4073*******"; //masked here for privacy
        String da2="+4075*******"; //masked here for privacy
        int x = 0;
        
//        msg.setStatusReport(true);
        
        
        for (int i = 0; i < 5; i++) {
            
            //msg.setText("Test <<" + i+1 + ">>");
            x=i+1;
            msg.setText("Test -= " + x + " =-");

            if (gateways.get(0).getOperator().equals("vodafone")) {
                //OutboundMessage msg = new OutboundMessage(da1,"Test -= " 
+ x + " =-" );
                msg.setRecipient(da1);
                logInfo("Sending message -= " + msg.getText() + " =- To: << 
" + msg.getRecipient()  + " >> via gateway " + 
gateways.get(0).getGatewayId() + " [ " + gateways.get(0).getOperator() + " 
] " );
                Service.getInstance().queueMessage(msg, 
gateways.get(0).getGatewayId()); 
            }
            if (gateways.get(0).getOperator().equals("orange")) {
                //OutboundMessage msg = new OutboundMessage(da2,"Test -= " 
+ x + " =-" );
                msg.setRecipient(da2);
                logInfo("Sending message -= " + msg.getText() + " =- To: << 
" + msg.getRecipient()  + " >> via gateway " + 
gateways.get(0).getGatewayId() + " [ " + gateways.get(0).getOperator() + " 
] " );
                Service.getInstance().queueMessage(msg, 
gateways.get(0).getGatewayId()); 
            }
            if (gateways.get(1).getOperator().equals("vodafone")) {
                //OutboundMessage msg = new OutboundMessage(da1,"Test -= " 
+ x + " =-" );
                msg.setRecipient(da1);
                logInfo("Sending message -= " + msg.getText() + " =- To: << 
" + msg.getRecipient()  + " >> via gateway " + 
gateways.get(1).getGatewayId() + " [ " + gateways.get(1).getOperator() + " 
] " );
                Service.getInstance().queueMessage(msg, 
gateways.get(1).getGatewayId()); 
            }
            if (gateways.get(1).getOperator().equals("orange")) {
                //OutboundMessage msg = new OutboundMessage(da2,"Test -= " 
+ x + " =-" );
                msg.setRecipient(da2);
                logInfo("Sending message -= " + msg.getText() + " =- To: << 
" + msg.getRecipient()  + " >> via gateway " + 
gateways.get(1).getGatewayId() + " [ " + gateways.get(1).getOperator() + " 
] " );
                Service.getInstance().queueMessage(msg, 
gateways.get(1).getGatewayId()); 
            }
            
            
        }

My plan is to send 5 SMS to da1 and 5 SMS to da2 and to send as text "Test 
-= " + x + " =-" where x + i+1


The result is :
10 sms are sent to only one destination ( 5 from one gateway 5 from the 
other )  and the text is "Test -= 5 =-" for all 10 messages

If I uncomment the lines where a new Outbound msg object is declared each 
time ( like new OutboundMessage(da2,"Test -= " + x + " =-" );) then that 
works ok 
My logic says that it should work without creating a new object on each 
cycle of a for iterration

I am not using any (already implemented) smslib routing because I plan to 
use a different more advanced routing

So, to conclude ... I suspect that there is a but somewhere, because the 
last value of the i+1 is used to all messages

the logInfo lines log something like this:
07-26-19:56:51,842 [main] INFO  flysms.ro.FlySmsGw  - GTW: : Sending 
message -= Test -= 1 =- =- To: << +4073******* >> via gateway 
Modem./dev/ttyUSB1 [ vodafone ]
07-26-19:56:51,846 [main] INFO  flysms.ro.FlySmsGw  - GTW: : Sending 
message -= Test -= 1 =- =- To: << +4075******* >> via gateway 
Modem./dev/ttyUSB0 [ orange ]
07-26-19:56:51,847 [main] INFO  flysms.ro.FlySmsGw  - GTW: : Sending 
message -= Test -= 2 =- =- To: << +4073******* >> via gateway 
Modem./dev/ttyUSB1 [ vodafone ]
07-26-19:56:51,848 [main] INFO  flysms.ro.FlySmsGw  - GTW: : Sending 
message -= Test -= 2 =- =- To: << +4075******* >> via gateway 
Modem./dev/ttyUSB0 [ orange ]
07-26-19:56:51,849 [main] INFO  flysms.ro.FlySmsGw  - GTW: : Sending 
message -= Test -= 3 =- =- To: << +4073******* >> via gateway 
Modem./dev/ttyUSB1 [ vodafone ]
07-26-19:56:51,851 [main] INFO  flysms.ro.FlySmsGw  - GTW: : Sending 
message -= Test -= 3 =- =- To: << +4075******* >> via gateway 
Modem./dev/ttyUSB0 [ orange ]
07-26-19:56:51,852 [main] INFO  flysms.ro.FlySmsGw  - GTW: : Sending 
message -= Test -= 4 =- =- To: << +4073******* >> via gateway 
Modem./dev/ttyUSB1 [ vodafone ]
07-26-19:56:51,853 [main] INFO  flysms.ro.FlySmsGw  - GTW: : Sending 
message -= Test -= 4 =- =- To: << +4075******* >> via gateway 
Modem./dev/ttyUSB0 [ orange ]
07-26-19:56:51,854 [main] INFO  flysms.ro.FlySmsGw  - GTW: : Sending 
message -= Test -= 5 =- =- To: << +4073******* >> via gateway 
Modem./dev/ttyUSB1 [ vodafone ]
07-26-19:56:51,856 [main] INFO  flysms.ro.FlySmsGw  - GTW: : Sending 
message -= Test -= 5 =- =- To: << +4075******* >> via gateway 
Modem./dev/ttyUSB0 [ orange ]


So this data is displayed on each cycle and is displayed correctly.
But the actual sending of the SMS starts by QueueManager after the cycles 
are completed and I asume there is something wrong inside the queue 

Anyone had similar situation ??




-- 
You received this message because you are subscribed to the Google Groups 
"SMSLib Discussion Group" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/smslib/-/VV-UXxLO8loJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to