We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Micro vs cli application

howdy and happy new year!!!

Things on my mind this nice evening are:

when do you use a micro application and when do you use a cli application?

I've using phalcon for some time, but only the default project version, and this works gr8. I have finally graso most of the major concepts(di, events, and more). but currently we are developing a non web application. more of a helper to recive log info from sevral servers, send some commands and operate on the logs.

But i fail to find the best way of doing this, should i use a micro or cli application to achive this?

This aaplication will be controlled by one or many front end servers,,whom will also display some info generated by the coi/micro? application

Currently we are using the cli framework to do the basics but since we dont use use any cli inputs, we wonder if this is the best way of doing the implimetation? is there any difference on the di for cli vs the di for a micro application?

regards André



16.4k

I would personally go with CLI

In general if its a micro I would use it for API commands / queue always go with CLI

thanks for your input.

the thing that confuses me is that the application will use a REST api for recieving commands. Can you setup cli to manage http resquests as well?



16.4k
edited Jan '16

what about sending the commands via queue and you handle it with the CLI

Just simple : CLI application for everything that doesnt need to be done while request-response time. For example sending emails.

Tanks for you response.

Right now i'm using a bad websocket implementation to recive the remote commands. But i don't wan't to use websockets.

But would it be possible to use a micro application with a REST API to communicatio with a bootstraped application (cli or custom) using beanstalk /redis? Regards



16.4k
Accepted
answer

@joyider yep thats the way we do it, if the API has to send anything to the CLI we use queues with beanstalkd

Tanks for you response.

Right now i'm using a bad websocket implementation to recive the remote commands. But i don't wan't to use websockets.

But would it be possible to use a micro application with a REST API to communicatio with a bootstraped application (cli or custom) using beanstalk /redis? Regards

Beanstalkd is way to do it. But if you want send something to user from cli then only websocket is way to do it. You can always use both tbh.

Thank you now i finnaly have a clear picture of how to proceed.

Might need to use websocket but hopfully I can get the needed info from the database and use a javascript poller :)

Regards



16.4k

@joyider I use to comunicate between the CLI and website https://pusher.com/

Thank you now i finnaly have a clear picture of how to proceed.

Might need to use websocket but hopfully I can get the needed info from the database and use a javascript poller :)

Regards