首页 > 解决方案 > 在 Enterprise Architect 中建模网络交互的正确方法

问题描述

我有一个类Actor,其实例发送/接收网络消息。(例如,该类的每个实例都是在不同物理机器上运行的不同进程的一部分。)网络消息是类的序列化实例,MessageAMessageB属性通过线路发送。Actor传入消息由我的类的回调方法方法处理。通过调用我的Actor类的方法触发了一条消息。因此,我开始在类图中对这种情况进行建模,如下所示:

类图

现在,我想对一个典型的交互进行建模,并开始绘制以下时序图:

序列图

这些消息不是方法调用,而是异步的,并且有一种“信号”,允许我为它们分配正确的消息类型。

但是,我想知道我如何建模

  1. 带有有效负载的消息MessageAonMessageAReceived

  2. 该方法sendMessageA发出带有有效负载的消息MessageA

    (注意:就我的实现而言,sendMessageA返回 void 是正确的,因为发送网络消息是异步的,被卸载到底层操作系统,并且该方法在发送消息后返回给它的被调用者。)

在序列图中。

也许,我的整个方法是完全错误的,我试图建模一些无法像这样建模的东西。在这种情况下,非常欢迎一些指向正确方法的指针。

标签: enterprise-architectsequence-diagram

解决方案


Of course there's more than one way to model this (and it does not depend on the tool EA). So, you should ask which audience you are talking to, repsectively which their domain is basically.

Technical

A SD is well suited to show a physical transport. In that case you concentrate on the way how messages are sent. In this case you will have the physical operations shown as messages. E.g. using sockets, it would be some (a-)synchronous send(message) which assures that the content message is transported from A to B. This could be at any level of technical implementation from rough to single CRCs being sent (or how the operation is internally built to ensure packages are not lost).

Logical

In order to show a more logical aspect it's a good idea to have components (being deployed on multiple hardware) having ports (realizing some interface) along which you have an information flow (which is a connector you will find in EA) that can transport something (that is your message classes).

Overview

You might want to describe both aspects in your model. But likely you will have the focus on the one or other part depending on your overall domain.

There is no single way to model something. Models are always abstraction which is why we create models. They shall show reality, but more light weight.


推荐阅读