All Products
Search
Document Center

Manage the micro application and service

Last Updated: Mar 10, 2021

After dividing the business into micro application and service, you will not only achieve high cohesion and low coupling among modules, but also can manage micro application and service by virtue of the context provided by mPaaS iOS framework, including micro application-to-micro application, service-to-service and micro application-to-service jumping and data transmission.

Manage micro applications

Framework context manages the jumps of all micro applications in a unified way through stack, and in compliance with the following rules:

application

  • Based on mPaaS iOS framework, you can quickly find a micro application by using its name and start another micro application in the current micro application.

    1. - (void)pushSubApp2
    2. {
    3. [DTContextGet() startApplication:@"20000002" params:@{} launchMode:kDTMicroApplicationLaunchModePushWithAnimation];
    4. }
  • The upper-level micro application in the stack can quickly jump to the root application at the bottom.

    1. - (void)exitToLauncher
    2. {
    3. //Since Launcher is at lower-level, starting Launcher means exiting from all upper-level applications and back to Launcher
    4. [DTContextGet() startApplication:@"Launcher" params:nil animated:kDTMicroApplicationLaunchModePushNoAnimation];
    5. }
  • Quickly exit from the current micro application.

    1. - (void)exitSelf
    2. {
    3. [[DTContextGet() currentApplication] exitAnimated:YES];
    4. }
  • Quickly exit from the started micro application.

    1. - (void)exitApp2
    2. {
    3. // If current top-level application is app3, it is workable to force app2 and its windows to exit.
    4. [[DTContextGet() findApplicationByName:@"20000002"] forceExit];
    5. }

Manage services

  • Based on mPaaS iOS framework, you can quickly start another service in the current micro application.
  1. - (void)findService
  2. {
  3. id<DemoService> service = [DTContextGet() findServiceByName:@"DemoService"];
  4. [service doTask];
  5. }