BE CONSTRUCTOR for REST METHOD
 
Forums / SmartComponent Library - Developer Forum / BE CONSTRUCTOR for REST METHOD

BE CONSTRUCTOR for REST METHOD

4 posts, 1 answered
  1. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    16 Jun 2022
    Link to this post
    Should the CONSTRUCTOR of a BE fire when a REST front end is calling a METHOD in the BE?

    If using the APSV transport with a WC front end the CONSTRUCTOR fires but when calling methods from a REST front end the CONSTRUCTOR does not get called.
  2. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    16 Jun 2022 in reply to Roger Blanchard
    Link to this post
    .
    Last modified on 16 Jun 2022 18:06 by Roger Blanchard
  3. Mike Fechner
    Mike Fechner avatar
    319 posts
    Registered:
    14 Sep 2016
    Answered
    16 Jun 2022 in reply to Roger Blanchard
    Link to this post
    Business Entities are by default kept loaded after the first request. This is done by the ServiceManager component and behaves the same independent on the type of consumer.

    There is a small difference with AppServers configured for RESTful access: The launch all Business Entities that support RESTful endpoints when the AppServer is startedto query for the RESTful endpoints/addresses.

    You can control the life-time of Business Entities using the life-cycle management: https://consultingwerk.atlassian.net/wiki/spaces/SCL/pages/8094650/Managing+the+life+cycle+of+Business+Entities+and+Business+Tasks

    Once they are shut down - they need to be restarted for the next requests.

    I'm not going to ask why this is relevant though. As per definition (e.g. CCS) Business Entities are stateless services. So the Constructor should not do anything state-related. 
  4. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    16 Jun 2022 in reply to Mike Fechner
    Link to this post
    >> There is a small difference with AppServers configured for RESTful access: The launch all Business Entities that support RESTful endpoints when the AppServer is startedto query for the RESTful endpoints/addresses.

    Okay, that is why we did not see it...thanks for that.

    >> As per definition (e.g. CCS) Business Entities are stateless services. So the Constructor should not do anything state-related. 

    We were calling ServiceContainer:GetService and assigning to a variable. We have removed that code and moved it into the METHODS

    Thanks for the quick response.
4 posts, 1 answered