opentelecoms-org / jsmpp

SMPP implemented in Java
Apache License 2.0
232 stars 163 forks source link

Is onAcceptSubmitSm async when running in server mode? #144

Open javadevmtl opened 3 years ago

javadevmtl commented 3 years ago

Hi, speaking from server perspective. When we receive submit_sm and the onAcceptSubmitSm event is called when we return the MessageId for the subsmit_sm_resp.

Can the following be done?

@Override
public MessageId onAcceptSubmitSm(SubmitSm submitSm, SMPPServerSession source) throws ProcessRequestException {

     SomeApiClient client = new SomeApiClient();
     client.sendAsync(foo -> 
     {
         if(success)
               System.out.println("Message was sent async do nothing");
         else
               System.out.println("Failed");
               Here we can send async DELIVER_SM with failure code?
     });

     // Return immediate SM response
     return idGenerator.newMessageId();
}

I'm guessing if our logic doesn't care if the async call was successful or not immediately the return MessageId (submit_sm_resp) before completion it's ok. And if the async call to the downstream API failed send back a deliver_sm with a faillure?