From 2aba90bcbd319b8c9a05daa879c0020fa8cfc26d Mon Sep 17 00:00:00 2001 From: Ilia Krustev Date: Mon, 5 Aug 2019 16:22:14 +0300 Subject: [PATCH 1/2] Increase the default timeout for MQTT requests. --- src/main/resources/application-dev.yml | 2 +- src/main/resources/application-production.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 12e0f29..beb0ded 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -19,7 +19,7 @@ mqtt: username: micro topic: events/1//api/anon// keepAliveInterval: 20 - messageResponseTimeout: 2000 + messageResponseTimeout: 40000 metrics: port: 6680 diff --git a/src/main/resources/application-production.yml b/src/main/resources/application-production.yml index 752ba6c..99573aa 100644 --- a/src/main/resources/application-production.yml +++ b/src/main/resources/application-production.yml @@ -20,7 +20,7 @@ mqtt: username: ${MQTT_USERNAME:micro} topic: ${MQTT_TOPIC:events/1//api/anon//} keepAliveInterval: ${MQTT_KEEP_ALIVE:20} - messageResponseTimeout: ${MQTT_RESP_WAIT:2000} + messageResponseTimeout: ${MQTT_RESP_WAIT:40000} metrics: port: ${METRICS_PORT:6680} -- GitLab From 4946345815e18ede94e3308c544a5e743b949a85 Mon Sep 17 00:00:00 2001 From: Ilia Krustev Date: Mon, 5 Aug 2019 21:24:57 +0300 Subject: [PATCH 2/2] Work-around for importing erlang accounts which phone numbers do not match the one in the erlang profile. --- .../biz/nynja/bridge/model/PhoneMapper.java | 197 ++++++++++++++++++ .../java/biz/nynja/bridge/model/Profile.java | 2 +- 2 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 src/main/java/biz/nynja/bridge/model/PhoneMapper.java diff --git a/src/main/java/biz/nynja/bridge/model/PhoneMapper.java b/src/main/java/biz/nynja/bridge/model/PhoneMapper.java new file mode 100644 index 0000000..fe5cb37 --- /dev/null +++ b/src/main/java/biz/nynja/bridge/model/PhoneMapper.java @@ -0,0 +1,197 @@ +package biz.nynja.bridge.model; + +import java.util.HashMap; +import java.util.Map; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +class PhoneMapper { + + static String map(String phone) { + if (phone == null) { + return null; + } + String mapped = mappedPhones.get(phone); + if (mapped == null) { + return phone; + } + log.warn("MAPPED PHONE {} to {}", phone, mapped); + return mapped; + } + + private static Map mappedPhones; + + static { + mappedPhones = new HashMap<>(); + + mappedPhones.put("821088460047", "8201088460047"); + mappedPhones.put("821052905400", "8201052905400"); + mappedPhones.put("821053898566", "8201053898566"); + mappedPhones.put("821096152187", "8201096152187"); + mappedPhones.put("821033799415", "8201033799415"); + mappedPhones.put("821028569302", "8201028569302"); + mappedPhones.put("821056287962", "8201056287962"); + mappedPhones.put("855887500576", "8550887500576"); + mappedPhones.put("27836912115", "270836912115"); + mappedPhones.put("821041014372", "8201041014372"); + mappedPhones.put("821091410141", "8201091410141"); + mappedPhones.put("821024823855", "8201024823855"); + mappedPhones.put("213772393590", "2130772393590"); + mappedPhones.put("821030508433", "8201030508433"); + mappedPhones.put("27844477147", "270844477147"); + mappedPhones.put("821022992356", "8201022992356"); + mappedPhones.put("821054911225", "8201054911225"); + mappedPhones.put("821063500321", "8201063500321"); + mappedPhones.put("27829282056", "270829282056"); + mappedPhones.put("821076781585", "8201076781585"); + mappedPhones.put("66910560333", "660910560333"); + mappedPhones.put("821075918987", "8201075918987"); + mappedPhones.put("27827819376", "270827819376"); + mappedPhones.put("821025199420", "8201025199420"); + mappedPhones.put("821093376532", "8201093376532"); + mappedPhones.put("27832558567", "270832558567"); + mappedPhones.put("380689759688", "3800689759688"); + mappedPhones.put("4366480919592", "43066480919592"); + mappedPhones.put("821040209907", "8201040209907"); + mappedPhones.put("821048085617", "8201048085617"); + mappedPhones.put("821066137898", "8201066137898"); + mappedPhones.put("821054451673", "8201054451673"); + mappedPhones.put("821050900515", "8201050900515"); + mappedPhones.put("821059197975", "8201059197975"); + mappedPhones.put("821074101032", "8201074101032"); + mappedPhones.put("821046976979", "8201046976979"); + mappedPhones.put("821062723002", "8201062723002"); + mappedPhones.put("821090528858", "8201090528858"); + mappedPhones.put("38169650900", "381069650900"); + mappedPhones.put("821063262362", "8201063262362"); + mappedPhones.put("821037933468", "8201037933468"); + mappedPhones.put("821088418816", "8201088418816"); + mappedPhones.put("821022772619", "8201022772619"); + mappedPhones.put("821042852261", "8201042852261"); + mappedPhones.put("821037012821", "8201037012821"); + mappedPhones.put("841284146685", "8401284146685"); + mappedPhones.put("84938561817", "840938561817"); + mappedPhones.put("84924488445", "840924488445"); + mappedPhones.put("821091054785", "8201091054785"); + mappedPhones.put("821063102090", "8201063102090"); + mappedPhones.put("821022521747", "8201022521747"); + mappedPhones.put("821039275438", "8201039275438"); + mappedPhones.put("94769319198", "940769319198"); + mappedPhones.put("84906193033", "840906193033"); + mappedPhones.put("251946340390", "2510946340390"); + mappedPhones.put("821053274994", "8201053274994"); + mappedPhones.put("27714226217", "270714226217"); + mappedPhones.put("821046211149", "8201046211149"); + mappedPhones.put("213560237213", "2130560237213"); + mappedPhones.put("971564843540", "9710564843540"); + mappedPhones.put("818030908338", "8108030908338"); + mappedPhones.put("821093414415", "8201093414415"); + mappedPhones.put("821095365194", "8201095365194"); + mappedPhones.put("821024722670", "8201024722670"); + mappedPhones.put("821088799444", "8201088799444"); + mappedPhones.put("821053180561", "8201053180561"); + mappedPhones.put("27727821877", "270727821877"); + mappedPhones.put("821050034426", "8201050034426"); + mappedPhones.put("821053580603", "8201053580603"); + mappedPhones.put("821026077569", "8201026077569"); + mappedPhones.put("821044772447", "8201044772447"); + mappedPhones.put("821052038402", "8201052038402"); + mappedPhones.put("821048948224", "8201048948224"); + mappedPhones.put("821075823927", "8201075823927"); + mappedPhones.put("821023553579", "8201023553579"); + mappedPhones.put("27828064165", "270828064165"); + mappedPhones.put("821064225533", "8201064225533"); + mappedPhones.put("821074760486", "8201074760486"); + mappedPhones.put("821095055158", "8201095055158"); + mappedPhones.put("821025067651", "8201025067651"); + mappedPhones.put("27734554048", "270734554048"); + mappedPhones.put("821050411142", "8201050411142"); + mappedPhones.put("821092059360", "8201092059360"); + mappedPhones.put("821020835387", "8201020835387"); + mappedPhones.put("61448338655", "610448338655"); + mappedPhones.put("821053752512", "8201053752512"); + mappedPhones.put("821047893153", "8201047893153"); + mappedPhones.put("821028662544", "8201028662544"); + mappedPhones.put("821075742105", "8201075742105"); + mappedPhones.put("821086127987", "8201086127987"); + mappedPhones.put("2348038256904", "23408038256904"); + mappedPhones.put("27835579193", "270835579193"); + mappedPhones.put("821092160700", "8201092160700"); + mappedPhones.put("2348106161935", "23408106161935"); + mappedPhones.put("27824948711", "270824948711"); + mappedPhones.put("94758171661", "940758171661"); + mappedPhones.put("821030097824", "8201030097824"); + mappedPhones.put("251911024033", "2510911024033"); + mappedPhones.put("213667648445", "2130667648445"); + mappedPhones.put("9647513720594", "96407513720594"); + mappedPhones.put("201223394529", "2001223394529"); + mappedPhones.put("923012665364", "9203012665364"); + mappedPhones.put("8801731755471", "88001731755471"); + mappedPhones.put("923369467015", "9203369467015"); + mappedPhones.put("231777073411", "2310777073411"); + mappedPhones.put("94777472306", "940777472306"); + mappedPhones.put("212610656652", "2120610656652"); + mappedPhones.put("213664243524", "2130664243524"); + mappedPhones.put("9647501655242", "96407501655242"); + mappedPhones.put("923071012912", "9203071012912"); + mappedPhones.put("821091277357", "8201091277357"); + mappedPhones.put("821020134792", "8201020134792"); + mappedPhones.put("249915260855", "2490915260855"); + mappedPhones.put("821023659551", "8201023659551"); + mappedPhones.put("212650233974", "2120650233974"); + mappedPhones.put("923103496993", "9203103496993"); + mappedPhones.put("923032434905", "9203032434905"); + mappedPhones.put("254718382617", "2540718382617"); + mappedPhones.put("8801745989697", "88001745989697"); + mappedPhones.put("923152615080", "9203152615080"); + mappedPhones.put("201097154722", "2001097154722"); + mappedPhones.put("923139849824", "9203139849824"); + mappedPhones.put("923084106848", "9203084106848"); + mappedPhones.put("9613773313", "96103773313"); + mappedPhones.put("213658246047", "2130658246047"); + mappedPhones.put("213781272574", "2130781272574"); + mappedPhones.put("201207091937", "2001207091937"); + mappedPhones.put("94755663149", "940755663149"); + mappedPhones.put("639976652744", "6309976652744"); + mappedPhones.put("966559430610", "9660559430610"); + mappedPhones.put("8801682325318", "88001682325318"); + mappedPhones.put("201280706009", "2001280706009"); + mappedPhones.put("923139620650", "9203139620650"); + mappedPhones.put("84979154986", "840979154986"); + mappedPhones.put("21254381155", "212054381155"); + mappedPhones.put("231886856529", "2310886856529"); + mappedPhones.put("8801716419186", "88001716419186"); + mappedPhones.put("85586890280", "855086890280"); + mappedPhones.put("821041791002", "8201041791002"); + mappedPhones.put("821074882888", "8201074882888"); + mappedPhones.put("2256325991", "22506325991"); + mappedPhones.put("2257663996", "22507663996"); + mappedPhones.put("8801734275777", "88001734275777"); + mappedPhones.put("8801933311225", "88001933311225"); + mappedPhones.put("8801876335171", "88001876335171"); + mappedPhones.put("8801792477577", "88001792477577"); + mappedPhones.put("8801992677007", "88001992677007"); + mappedPhones.put("8801723656317", "88001723656317"); + mappedPhones.put("821067370206", "8201067370206"); + mappedPhones.put("233205665798", "2330205665798"); + mappedPhones.put("9647723476272", "96407723476272"); + mappedPhones.put("9647504434843", "96407504434843"); + mappedPhones.put("8801745910597", "88001745910597"); + mappedPhones.put("8801725504404", "88001725504404"); + mappedPhones.put("8801631072192", "88001631072192"); + mappedPhones.put("821091290529", "8201091290529"); + mappedPhones.put("821088009310", "8201088009310"); + mappedPhones.put("821062047877", "8201062047877"); + mappedPhones.put("821053581300", "8201053581300"); + mappedPhones.put("821046666841", "8201046666841"); + mappedPhones.put("821032802293", "8201032802293"); + mappedPhones.put("601125464522", "6001125464522"); + mappedPhones.put("27718842464", "270718842464"); + mappedPhones.put("2257735458", "22507735458"); + mappedPhones.put("213795256206", "2130795256206"); + mappedPhones.put("212679481309", "2120679481309"); + mappedPhones.put("201272687229", "2001272687229"); + mappedPhones.put("201145288278", "2001145288278"); + } + +} diff --git a/src/main/java/biz/nynja/bridge/model/Profile.java b/src/main/java/biz/nynja/bridge/model/Profile.java index 6b91b67..727a4c7 100644 --- a/src/main/java/biz/nynja/bridge/model/Profile.java +++ b/src/main/java/biz/nynja/bridge/model/Profile.java @@ -45,7 +45,7 @@ public class Profile implements MQTTModelBase { .addAtom("Feature") .addStringAsBinary(profileData.getProfileId()) .addStringAsBinary("PHONE") - .addStringAsBinary(profileData.getPhoneNumber()) + .addStringAsBinary(PhoneMapper.map(profileData.getPhoneNumber())) .addStringAsBinary("PROFILE_DATA") .build() ) -- GitLab