Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for receipted_message_id & fix correlation_handler bug #97

Closed
2 tasks
komuw opened this issue Feb 6, 2019 · 1 comment · Fixed by #98
Closed
2 tasks

add support for receipted_message_id & fix correlation_handler bug #97

komuw opened this issue Feb 6, 2019 · 1 comment · Fixed by #98
Labels
bug Something isn't working enhancement New feature or request

Comments

@komuw
Copy link
Owner

komuw commented Feb 6, 2019

We are currently using sequence_numbers to correlate a request to smsc and a response from smsc:

naz/naz/client.py

Lines 380 to 386 in 881c1fe

# associate sequence_number with log_id.
# this will enable us to also associate responses and thus enhancing traceability of all workflows
try:
await self.correlation_handler.put(
sequence_number=sequence_number, log_id=log_id, hook_metadata=""
)
except Exception as e:

The SMSC spec has an optional parameter user_message_reference that you can send to SMSC as part of the request(submit_sm) and SMSC will send it back in the response(deliver_sm)

see section 4.4.1 & 4.6.1 of smpp spec.

Two things to note:

  1. when you send submit_sm the sequence_number you specify is returned in the submit_sm_resp.
    However, that sequence_number is not available in the deliver_sm request from SMSC.
    This means that our correlation as it currently exists;

    naz/naz/client.py

    Lines 380 to 386 in 881c1fe

    # associate sequence_number with log_id.
    # this will enable us to also associate responses and thus enhancing traceability of all workflows
    try:
    await self.correlation_handler.put(
    sequence_number=sequence_number, log_id=log_id, hook_metadata=""
    )
    except Exception as e:

    is broken.
    We need to implement user_message_reference to try and fix that

  2. When you send a user_message_reference in submit_sm, it is not returned in submit_sm_resp. it is only returned in deliver_sm.

So way forward:

  • continue using our current correlation, but only to correlate submit_sm and submit_sm_resp
  • implement receipted_message_id to correlate submit_sm and deliver_sm

One is a bug while the second one is a feature request.

We should at the very least fix the bug

@komuw komuw added bug Something isn't working enhancement New feature or request labels Feb 6, 2019
@komuw komuw changed the title add support for user_message_reference add support for user_message_reference & fix correlation_handler bug Feb 6, 2019
@komuw
Copy link
Owner Author

komuw commented Feb 8, 2019

Here's an alternative correlation workflow.

@komuw komuw changed the title add support for user_message_reference & fix correlation_handler bug add support for * receipted_message_id & fix correlation_handler bug Feb 9, 2019
@komuw komuw changed the title add support for * receipted_message_id & fix correlation_handler bug add support for receipted_message_id & fix correlation_handler bug Feb 9, 2019
@komuw komuw closed this as completed in #98 Feb 9, 2019
komuw added a commit that referenced this issue Feb 9, 2019
What:
- Fix a bug of correlation between `submit_sm_resp` and `deliver_sm`

Why:
- The way `naz` was handling correlations was:
    - when sending `submit_sm` we save the `sequence_number`
    - when we get `submit_sm_resp` we use its `sequence_number` and look it up from Correlater  
    - when we get a `deliver_sm` request, we use its `sequence_number` and look it up from Correlater

    The way `naz` now does it after the fix is;
    - when sending `submit_sm` we save the `sequence_number`
    - when we get `submit_sm_resp` we lookup `sequence_number` and use it for correlation
    - Additionally, `submit_sm_resp` has a `message_id` in the body. This is the SMSC message ID of the submitted message.
    - We take this `message_id` and save it.
    - when we get a `deliver_sm` request, it includes a `receipted_message_id` in the optional body parameters.
    - we get that `receipted_message_id` and use it to lookup from where we had saved the one from `submit_sm_resp`

- This implementation is not without fault; as before Correlation is still on a best effort.
   We are using `receipted_message_id` to correlate `submit_sm_resp` and `deliver_sm`; 
   However, `receipted_message_id` is an optional tag that SMSC can omit; and they do omit[1][2][3]

- fixes: #97

References:
1. opentelecoms-org/jsmpp#62
2. praekeltfoundation/vumi#298
3. praekeltfoundation/vumi#637
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant