Reactive-NFe is an old project(begin 2019), wherein I was training interface design for Delphi. I decided to resume it because I was missing Delphi, after 10 months of programming in Java without stopping, hahaha.
This project basically contains:
- A simple example of how to create application interfaces that are very attractive and provide rich interaction to the user
- An introduction to Reactive Programming, using two of its four pillars (see more):
- Responsive - A system of NFe which the user can monitor the status of each NFe in real-time
- Resilient
- Elastic
- Message Driven - We use an asynchronous message to establish communication between our view-layer and infrastructure-layer
- Cache service to the principal numbers in user dashboard
- My vision of how to would be a software development approach in which design is domain-driven(DDD), described in the book of Uncle Bob, applied in Delphi
- FireMonkey Framework in Delphi Tokyo 10.2.3
- Redis 5.0.3
- To clone and run this application, you'll need Git installed on your computer(or no, if you want to download .zip). From your command line:
# Git CLI
git clone https://github.com/zevolution/reactive-nfe.git
# Github CLI
gh repo clone zevolution/reactive-nfe
-
You must have
Redis
installed on your computer. We use PUB/SUB of Redis to insert and change the state of the NFe's in the view-layer. Below in Notes, I will provide some links that can help you. -
To use Redis as a primary cache service, you must add the 3 primary keys to the cache. After connecting in Redis via redis-cli use the commands below:
SET numerodeclientes 18729
SET numerodeusuarios 719246
SET valortotaldenotas 932669872
-
Open the project in your IDE.
-
Configure the Redis connection properties into
Redis.Config.pas
andRedis.Cache.Service.pas
-
Configure which cache service you want to use in FormCreate method into
Principal.View.pas
{* You can choose between Redis and MemCached as a cache service *}
//FCache := TRedisCacheService.New(TRedisConfig.New);
FCache := TMemCachedCacheService.New(TMemCachedConfig.New);
- In this application, we have a personalized ListBox to present the NFe's. You must import the file
ListBoxItem1-StyleNFeNegrito.style
, which are in directoryStyles
(inside project directory) into StyleBook1 component, in PrincipalView (see more).
You can modify Build configurations
to Debug or Release. And use the shortcut SHIFT+F9 to build application and F9 to run with debugging.
- You can use Redis in RedisLabs as a cloud service. They provide you a dedicated database for free, with a memory size with up
30MB
and with up to 30 connections concurrent - You can use a Docker Image. For non-production uses, in this case, a simple test, I recommend the Alpine version. I believe that is one of the lightest version, collaborating in the initialization of the container. Use the command docker pull redis:6.0.5-alpine
- ATTENTION: For windows installation read this article
If you do not have Delphi, you can do download and use Delphi-CE.
- Thulio Bittencourt - Maintainer of the Thulio Bittencourt channel on Youtube, where he passes on much of his knowledge in his videos for free, talking about UI&UX and many other topics such as clean code, NoSQL, high-performance servers and how to make your business go high.
- Mário Guedes (What Mario? haha) - Known as the great software artisan, he works as an architect of high-performance solutions. He helped me with his lectures (TDC2018) and examples on Github, showing the power of Redis
- Alan Franco - Thanks for reactive programming tips