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

Push notification server support for text messages #2548

Merged
merged 12 commits into from
Oct 9, 2017

Conversation

agafox
Copy link
Contributor

@agafox agafox commented Oct 5, 2017

No description provided.

@agafox
Copy link
Contributor Author

agafox commented Oct 9, 2017

Link to test-suite results: https://cxs.restcomm.com/view/Restcomm/job/UPS_RestComm-Specific-Branch/6/#showFailuresLink

There is no regression at all

}
system.scheduler().scheduleOnce(Duration.create(delay, TimeUnit.MILLISECONDS), new Runnable() {
Copy link
Contributor

@jaimecasero jaimecasero Oct 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main motivation here is to use akka ecosystem. The same thing was implemented in CallManager and we agreed with @gvagenas about that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, this is new dicussion with @gvagenas . There is a pending change in RC to use SIPServlets from proper SipServletsASyncWork, so no concurrent situations lead to inconsistencies, but agree this is a different topic, up to you on how to do this...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it with akka scheduler just to leave this functionality with the same approach in all parts of RC. After that we can make a decision to use akka ecosystem or SipServletsASyncWork and to create new task for refactoring in whole RC code

} else {
delay = pushNotificationServerHelper.sendPushNotificationIfNeeded(toClient.getPushClientIdentity());
}
system.scheduler().scheduleOnce(Duration.create(delay, TimeUnit.MILLISECONDS), new Runnable() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above

if (logger.isDebugEnabled()) {
logger.debug("Push server notification to client with identity: '" + pushClientIdentity + "' added to queue.");
}
Futures.future(new Callable<Void>() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why dont you use Downloader actor? is already wrapping the http client, and later the refactorign to use acutal nonBlocking http client will be easier if we all use the saem http Downloader actor...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downloader actor is for downloading RCMLs. I'm not sure that it's good thing to use it for internal API calls

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right ,there are some xml validation when response is ready, what a pity...

wireMockRule.addMockServiceRequestListener(new RequestListener() {
@Override
public void requestReceived(com.github.tomakehurst.wiremock.http.Request request, com.github.tomakehurst.wiremock.http.Response response) {
if (request.getAbsoluteUrl().contains("/api/notifications") && response.getStatus() == 200) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this ismulating alice phone receiving push notification and register the phone through the mobile app? quite smart choice of mock usage... ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it is

@SuppressWarnings("Duplicates")
@Deployment(name = "SmsPushNotificationServerTest", testable = false)
public static WebArchive createWebArchiveNoGw() {
logger.info("Packaging Test App");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call reconfigurePorts here.

use new utility and make sure all ports are mapped so we allow parallel testing as in https://github.com/RestComm/Restcomm-Connect/blob/master/restcomm/restcomm.testsuite/src/test/java/org/restcomm/connect/testsuite/sms/SmsTest.java#L577

private static final String CLIENT_PASSWORD = "qwerty1234RT";

@Rule
public WireMockRule wireMockRule = new WireMockRule(8090);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (logger.isDebugEnabled()) {
logger.debug("Push server notification to client with identity: '" + pushClientIdentity + "' added to queue.");
}
Futures.future(new Callable<Void>() {
Copy link
Contributor

@jaimecasero jaimecasero Oct 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why dont we use the returned Future and register a OnComplete functions, instead of scheduling a fixed delay task later...? OnComplete function coudl be passed as argument to make it generic, and let client configure oncomplete logic

@agafox agafox merged commit 715ec9c into master Oct 9, 2017
@jaimecasero jaimecasero deleted the push-notification-server-sip-message branch April 11, 2018 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants