Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Ryan Liang
    @ryanliang88
    Irregardless, still extremely valuable and thank you for your work!
    Piotr Gankiewicz
    @spetz
    Hey all, apologies for being unavailable for quite tome time
    git-clone-all.sh which contains some bash magics :)
    @ryanliang88 you can use FluentValidation to perform a validation for data input (e.g. price > 0, email is valid etc.), but you should always keep your domain models in the valid state, thus they should always ensure that constructors and other methods that valide its internal state will never put a domain object in an invalid state (invariants should be always valid)
    your domain is not aware about other layers, so it should act as it's the core of your application that will always perform business logic in a valid state :)
    Piotr Gankiewicz
    @spetz
    @aldari that's a good question, but what do you mean by a running a long process? Something like e.g. a video processing logic that would take an hour to complete that you'd like to be able to cancel? In that case you're correct, whenever the user sends e.g. cancel video processing command, the microservice should be able to gracefully cancel such task (e.g. by keeping the cancellationTokens internally or so), however, when you usually think about running LLT (long living transactions), that spans between the different microservices, the commands/events that are part of e.g. saga are usually completed very quickly (the saga itself is a long-running process, but not a Task in a .NET meaning), so the cancellation token is not really required here :)
    In the meantime we're working on something new and much more granulated when it comes to reusable code and libraries for building small APIs / microservices: https://github.com/convey-stack - stay tuned :)
    Ryan Liang
    @ryanliang88
    @spetz Makes sense; that reinforced my understanding. Thank you!
    I see that validation isn't the same as always being in a valid state.
    What's the difference between your projects: Pacco, DNC, Convey, and MS's eShop and what I can learn from them / comparing them? I see some readmes - do you have a quick overview of where I should start if I want to start learning the microservices architecture?
    Piotr Gankiewicz
    @spetz
    Convey is a new stack, a set of small libraries that can be used in order to buil Web API / microservices (things like service discovery, load balancing, messaging etc. being split up into separate projects, basically the DShop.Common split into small and reusable packaages"
    Pacco is a new sample project, with a better architecture, using convey, it's about couriers and packages delivery (still WiP)
    Haven't looked too much at eShop, but one of the main differences would be that eShop (AFAIK), doesn't use async command processing (API Ocelot gateway is doing a sync HTTP request forwarding, which is quite common), however, there's an async integraion via events between microservices :)
    Tomasz Repel
    @tomzre
    Hi all.
    I've got a question regarding DDD and EF Core. I know @spetz you are not support of EF itslef. But maybe someone can help :). So... I don't really know have to handle one to many relatioship with EF and ddd. In RDMBS I should have a transaction table that holds relation between two tables eg. User has many book so it should be one more table that holds relation user to book eg UserBook with user and book ids? Am I right? So should I have one more class that representing this 'UserBook'?
    developerhakart
    @developerhakart
    Hey Guys awesome video series !
    developerhakart
    @developerhakart
    Guys seems i noticed one issue related DI, there are the cases where subscribed Commands/Events and using repositories inside them. Probably you get injection issues because Subscribe use InstancePerDependency but repositories are injected as InstancePerLifetimeScope. So each command/event handling action you will get same repository instance. You can easily reproduce it by Get/Update/Get or Get/Add/Get flow in your Customers Handlers. You will see that Add or Update not reflect in same scope.
    Ngô Văn Quý
    @cotty_gitlab
    Hi everybody I use microservice to create a service write all api for website (such as getMenu getnews getProject ) so should I use httpClientService or Rabbit to get all of that ?
    Piotr Gankiewicz
    @spetz
    @tomzre you should implement 2 different models - one being your domain model, and another one being DB model. Simply load the DB model using any ORM that you like, and then create a proper domain model based on the data :).
    @developerhakart thanks! Same repository instance is fine, but thanks for the info - you're correct, repositories should be probably treated "as transient".
    @cotty_gitlab what do you mean? Are you asking whether you should use async or sync (HTTP) API Gateway or something else?
    Ngô Văn Quý
    @cotty_gitlab
    my mean I have a website ecommerce .net mvc get data from a service API so what best way to get Data from that api Http request or rabbitmq
    Piotr Gankiewicz
    @spetz
    To query the data use HTTP request or things like WebSockets or gRPC, but not an async message broker like RabbitMQ :).
    henrybotha909
    @henrybotha909

    First post. Guys, thank you for all the hard work you put into DevMentors, you are amazing for sharing with the community!!

    Can anyone point me to a resource where i can learn more about consuming an API with JWT token? I can make POST/GET requests, but i'm uncertain what to do with the token and have a few practical questions that i can't find answers too...
    Do i store the token in my httpclient class? should the httpclient class be a singleton? if it is a singleton, how do you ensure each user has their own token and aren't using someone else's token..?

    Yosr Naija
    @YosrNaija_twitter
    Hi Guys, Thank for the videos. I began the first episode yesterday. Every think works except one thing. I can't access to the route http://localhost:5000/products but I can only access to http://localhost:5007/. Is there any config that I forgot to do
    Eric Gitonga Njue
    @EricNjue
    Hi guys... I've a scenario where, in a post method, am sending data to a queue and is received nicely. During a put request with modified data on the body, the data which is received by the consumer is the 1st one that was sent during the post request. What could trigger such behavior?
    Piotr Gankiewicz
    @spetz
    @henrybotha909 what kind of questions? You shouldn't store the JWT in your code or HTTP Client, if you're building microservices, usually the API Gateway is responsible for dealing with auth (or you can use additional tools like e.g. Identity Server 4.0) and each HTTP request might contain Authorization: Bearer {token} HTTP header which is how you deal with different users
    @YosrNaija_twitter hey, have you started the API Gateway project that should be hosted on localhost:5000 and the products microservice that can handle this route?
    @EricNjue what's exactly happening, could you paste some sample code please?
    Piotr Gankiewicz
    @spetz
    @/all hey, just wanted to let you know that we're close to complete the docs for Convey https://convey-stack.github.io :)
    Tomasz Repel
    @tomzre
    @spetz thanks for the answer :). Eventually ended up with something like this -> https://github.com/tomzre/futbal.mng.webapi/tree/master/src/Futbal.Mng.Domain/Event
    but didn't know of keeping seperate models for orm and domain model until you said.
    It seemed as overkill for me at first but looked over the internet and people using it as they said it might be an overkill at first but it is better to keep them seperate in long term.
    regards
    Piotr Gankiewicz
    @spetz
    @tomzre you don't always need to do it (e.g. when creating a simple CRUD it could be overkill), but in terms of rather complex application and sticking to DDD principles it might pay off in a long term :)
    Eric Gitonga Njue
    @EricNjue
    @spetz , in regards to Convey, security to be precise. Let's say I have Auth application (SSO) that I would want to use for auth purposes. How can one achieve that, because ideally after a successful auth I already have a token that I can use.
    And btw, Once again thank you so much for the amazing work that you guys do.
    Eric Gitonga Njue
    @EricNjue
    @spetz ,also kindly explain the purpose of CorrelationContext
    Eric Gitonga Njue
    @EricNjue
    @spetz , also let's say I want to set a Dbcontext from program main method & specify the conn string from IConfiguration, how can that be Achieved?
    Piotr Gankiewicz
    @spetz
    As discussed via FB, the correlation context is about keeping the request details (which can be anything you want) and passing it along all of the commands/events that might be a part of a longer chain :)
    Antonis
    @anto0ine_twitter
    Hey guys. Great work!
    What was the reason you went with Mongo and not mysql or postgres or any other relational? I mean the schema is pretty defined in such sort of apps. If we were talking about a big eshop or app with thousands of users would the same still apply or you would lean towards a relational database?
    Fuady Rosma Hidayat
    @fuadyhidayat
    Hey guys! Awesome works! Greetings from Indonesia ;)
    Piotr Gankiewicz
    @spetz
    Hi and thanks! @anto0ine_twitter mostly for the simplicity purposes, and yes, it still would make sense to use it in a big eshop with thousand of users, probably not for each microservices as DB selection should depend on its actual needs
    Antonis
    @anto0ine_twitter
    which parts of what you've implemented would you consider switching to some other db and why?
    Antonis
    @anto0ine_twitter
    And in addition to my previous question, shouldn't the "Cart" related logic be somewhere separate the Customers service?
    Dariusz Pawlukiewicz
    @GooRiOn
    Hi guyz, sorry for not responding for such a long time but... Im back :P
    @anto0ine_twitter it's also worth mentioning that Mongo itself (since it's NoSQL DB) is aggregate orriented and fits very well in DDD since aggregate persistence is atomic and does not cause weird issues like persisting aggreagte with lazy loading (some properities in different relations) with no guarantee that it still has the same Version
    Also keep in mind that we didn't want to end up with 1000 microservices because that would be way to hard to follow on YouTube thus we had to come up with some simplified modeling :D We could think about extracting some of the business logic to the separated microservices
    @fuadyhidayat thank you very much :)
    Eric Gitonga Njue
    @EricNjue
    @GooRiOn welcome back.
    Olli Elolähde
    @Olli64
    Which part of Convey actually parses customerId to lets say "CompleteCustomerRegistration" in Pacco? Since you don't have to specify it in body but it takes it from accesstoken?
    So Convey checks the JWT, passes customerId with the eventhandler to the invoked event so it already has the customerId? And if customerId is specified in body it doesnt try to overwrite it?
    Shouldn't the route be POST {{api}}/customers/me when you pass your own information?
    And only then the handler which gets the customerId from JWT injects it to event. Otherwise 400 bad request, customerId not specified or something?
    All this is is very new to me so apologies if its simple but I dont understand :P