12345678910111213141516171819202122232425262728293031 |
- % Tikz File mqtt_pub_sub.tex
- \documentclass{standalone}
- \usepackage{tikz, graphicx}
-
- \begin{document}
- \begin{tikzpicture}
- %\draw[help lines] (-7,-5) grid (7,5);
-
- \pgfmathsetmacro\pub{-4};
- \pgfmathsetmacro\bro{0};
- \pgfmathsetmacro\sub{4};
- \pgfmathsetmacro\y{4};
-
- \draw[ultra thick] (\pub,\y/2) -- (\pub,\y/-2);
- \draw[ultra thick] (\bro,\y/2) -- (\bro,\y/-2);
- \draw[ultra thick] (\sub,\y/2) -- (\sub,\y/-2);
-
- \draw[ultra thick, ->] (\sub,1) -- (\bro, 1);
- \draw[ultra thick, <-] (\sub,-1) -- (\bro, -1);
- \draw[ultra thick, ->] (\pub,0) -- (\bro, 0);
-
- \node at (\pub, \y/2+0.2) {Publisher};
- \node at (\bro, \y/2+0.2) {Broker};
- \node at (\sub, \y/2+0.2) {Subscriber};
-
- \node at (\sub/2, 1.2) {Subscribe (topic)};
- \node at (\pub/2, 0.2) {Publish (topic, info)};
- \node at (\sub/2, -0.8) {Publish (topic, info)};
-
- \end{tikzpicture}
- \end{document}
|