ChicagoBoss design pattern question: adding separate OTP apps / gen_servers to a ChicagoBoss app

113 views
Skip to first unread message

Alexander Gounares

unread,
Nov 17, 2012, 11:00:16 AM11/17/12
to chica...@googlegroups.com
Hi everybody...

Is there a recommended design pattern for adding a separate OTP app to a ChicagoBoss app?   In our case, for example, we'd like to have a portion of our web site performing long running jobs, and those jobs occasionally feed data back through a boss_mq queue.   In another case we have some transient 'global' state to keep track of that we don't want to persist through boss_db.

It looks like there are a few different ways to do this:
  1. make a completely separate OTP app and git repo and include it via rebar.config in the deps section and in in foo.app.src in the applications section.
  2. make a subdirectory under the main src directory (say src/apps/our_otp_app) and hook it into the compile process.
  3. just build a gen_server and hook into the existing ChicagoBoss app/supervisory tree (and in this case, what is the recommended way to do this?)

Is there a best practice we should be following here?

thanks everyone!
alex

Evan Miller

unread,
Nov 17, 2012, 3:58:48 PM11/17/12
to ChicagoBoss
Others might have better advice, but the standard way to include other OTP apps at this point is to put them in separate directories, and then start and stop them in your application's init scripts.

Evan


--
 
 



--
Evan Miller
http://www.evanmiller.org/

Chan

unread,
Nov 17, 2012, 9:36:47 PM11/17/12
to chica...@googlegroups.com
Yes separate dir, and you can add dependency in the app.src doing this your app start automatically and no need to start it from your script. erlang magic

Envoyé de mon iPhone
--
 
 

Alexander Gounares

unread,
Nov 18, 2012, 3:15:46 PM11/18/12
to chica...@googlegroups.com
excellent, thanks Chan and Evan--this is working out well for us so far.  

for future readers of this thread, you need to include the app path boss.config in a separate stanza...e.g...
[{boss, [....<existing boss config>]}, { my_boss_app, [...]}, {new_sub_app, [{path, "../my_boss_app/src/apps/new_sub_app"}].

cheers,
alex

--
 
 

luca.fin...@centervue.com

unread,
Aug 11, 2015, 6:35:46 AM8/11/15
to ChicagoBoss
Hi, i am trying to do this on my project, but unfortunately I can't get the new app to compile.
Its code is under my_boss_app/src/apps/utils/my_util/src 
I added the path to the boss.config
but when I launch rebar to do the build, it does not get compiled. 
A previous post mentioned the clear need to 'hook the new app to the compile process', but how can I do that? 
A bit of extra info: 
in my project, when I run the build via rebar, for each dependency in deps/, I have a couple of lines like
<dep1> (pre_compile)
<dep1> (compile)

but for the 'main' my_boss_app project, I only have one
<my_boss_app> (pre_compile)

Any hints? 
Thanks in advance. 

chan sisowath

unread,
Aug 11, 2015, 10:57:11 PM8/11/15
to chica...@googlegroups.com
it show you a way to build a release and add deps to your project.

deps are two different type CB and other regular otp app/lib,

if i recall you cannot have more than one CBApp as deps in your deps folder somehow  compilation stop and yeld no message, then your app crash at start.

2 work around:
 - put: all CB app in apps folder, and make a special rule to compile them with a makefile
   https://github.com/mihawk/draw/blob/master/Makefile#L13

 - or use my patched version of CB which fixe this problem:
 https://github.com/mihawk/ChicagoBoss branch new_compile_scheme

chan.










--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/7cd5d97c-1fcb-46a7-a3d5-cb2e64a476ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages