1 maerz practical applications of micro services in mitk...

38
5/30/2016 Practical Applications of Micro Services in MITK Keno März

Upload: others

Post on 01-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016

Practical Applications of

Micro Services in MITK

Keno März

Page 2: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Why do we need classes?

Page 3: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Rene Aigner - Monolith

A

B

C

D

E

F

G

Core

1) No separation of concerns

2) Seperation into modules

3) Seperation into micro services

Page 4: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 | Author

The ideal Micro Service

• One process

• One concern

• One interface

• „Shared Nothing“

Page 5: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Monolithic Software

A

B

C

D

E

F

G

Core

A

B

C

D 2.0

E

F

G

Core

A

B

C

D 2.0

E

F

G

Core

A

B

C

D 2.0

E

F

G

Core

A

B

C

D 2.0

E

F

G

Core

Page 6: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Maintenance

A

BC

D

D 2.0

Registry

Core

Page 7: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Scalability

A

BC

D 2.0

Registry

Core

D 2.0

Page 8: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Flexibility

A

BC

D 2.0

Registry

Core

D 2.0

More on on

that later!

Page 9: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Not a silver bullet

http://www.kassenzone.de/2016/04/21/microservices-einradfahren/

Page 10: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Topics

1. Intro

2. Implementation in MITK

3. Use-Case 1: Reader and Writer

4. Use-Case 2: IGT Devices

5. Conclusion

Page 11: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

C++ Micro Services

• http://cppmicroservices.org/

• Coder: Sascha Zelzer*

• Pure C++ implementation

* Google this name for more info

Page 12: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Three steps to your Micro Service

1. Implement it

2. Register it

3. Discover it

Page 13: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Create a Microservice: Implement it

Page 14: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Create a Microservice: Register it

• Example Implementation: mitk::USDevice

Page 15: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Service properties

• Map<string, us::Any>

• Can be used for filtering! (LDAP-Format)

Page 16: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Create a Microservice: Discover it

Two options available:

a) Search via ModuleContext

• Example: mitk::FileWriterRegistry

Page 17: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Create a Microservice: Discover it

Two options available:

a) Listen via EventListeners

• Example: QmitkServiceListWidget

Page 18: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Listening to changes

Page 19: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Topics

1. Intro

2. Implementation in MITK

3. Use-Case 1: Reader and Writer

4. Use-Case 2: IGT Devices

5. Conclusion

Page 20: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

The Situation

• I/O managed centrally from core

• I/O Implemented in modules

• Painful for 3rd-party devs

Page 21: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Design idea

• Microservice with properties:

• Supported MimeType

• Priority value (int)

• Additional registry classes for easy access

Page 22: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

The new IO Architecture

Page 23: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

3rd party creates reader

mitk::MyFileReader mitk::MyFileWriter

mitk::MyFileReaderAndWriter

Page 24: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Mime Types

Page 25: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Core

Implement new Reader

Registry

IOUtil

My Module

ASD Reader

ASD Mime

TypeFileReader

ServiceRegistry

Page 26: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Core

Supercede a Reader

Registry

IOUtil PicReader

Priority:100

FileReader

ServiceRegistry

My Module

BetterPicReader

Priority:101

Page 27: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Summary

• Micro ServicesG

• G give more control to 3rd party devs

• G make I/O process more dynamic

• G decouple decouple core I/O from modules

Page 28: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Topics

1. Intro

2. Implementation in MITK

3. Use-Case 1: Reader and Writer

4. Use-Case 2: IGT Devices

5. Conclusion

Page 29: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Situation

• IGT Tracking Toolbox:

• Great for tracking!

• Ultrasound Support:

• Great for ultrasound imaging!

• My Ultrasound Navigation Plugin

• I have to replicate it all again!

Page 30: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

MyDeviceConfigurator

Device design

1. Can be activated/deactivated

2. Has configuration plugin

3. Publishes pipeline endpoint

4. Registered as Micro Service

Device

Page 31: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Combining Devices

IGT Tracking Toolbox

Tracking

Device

Ultrasound Support

Ultrasound

Device

Ultrasound NavigationOpen IGT Link

Tracking

Device

Ultrasound

Device

Tracking Device

US Device

Page 32: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Summary

• MicroservicesG

• G facilitate reuse of workflows

• G enable sharing of instances across plugins

Page 33: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Topics

1. Intro

2. Implementation in MITK

3. Use-Case 1: Reader and Writer

4. Use-Case 2: IGT Devices

5. Conclusion

Page 34: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Where to start

• mitk::USDevice

• Basic Implementation

• Properties

• QmitkServiceListWidget

• Event Listening

• Filtering Micro Services

• mitk::FileReaderRegistry

• Active Micro Service search

Page 35: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Conclusion

Micro ServicesG

• G help achieve decoupling

• G promote reusability

• G require careful interface design

• G should be used with common sense

Page 36: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Future work

• Mappers as Micro Services:

• Smiliar to I/O scenario

• Micro Services for properties

• Distribute property resolution

Page 37: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

5/30/2016 |

Next up 3.

Page 38: 1 Maerz Practical Applications of Micro Services in MITK ...mitk-um.org/.../05/05_UM2016_MicroServices_Maerz.pdf · Intro 2. Implementation in MITK 3. Use-Case 1: Reader and Writer

Thank you for

your attention!

Further

information

on www.dkfz.de