Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Initial approach to a self service framework. The final form would be a fully fledged UI that would allow users to drag and drop flows and edit mappings.
For this initial phase, only the outbound flows will be exported, as the inbound ones are managed by the api-bundle and coupled by camel config.
New components added:
smartesb:flows:export
Exporter functionality should not be placed here, as eventually this project should be called from a browser, rather than a command.IsConfigurableService
trait got a new function calledgetMethodsConfiguration
that will return the method configuration. Method in this context is what defines what API in the target system should be called and what payload should be sent. We already had a setter for this property, this getter will return what the setter... sets. Given that this is internal configuration to the Producer, it was the most sensible place to put it, instead of hijacking this information while the container is built.smartesb.producer
, defined in the constantPRODUCER_TAG
.Flow exporter
The flow exporter introduces:
eval
to each mapping, which is a custom keyword that Symfony's evaluator doesn't support.Unmapper
, which is a fake mapper that will simple return the mappings that it knows about. Remember that, although the YML producer configuration holds the mapping information, this producer ignores each mapping as this is passed to the Mapper at built time.Unmapper
gets the same information as Mapper, but instead of mapping, it just returns the mapping definitionProducerMethod
andProducerMapping
, DTOs to handle all the information collected in a OO wayHow to test
Declare this branch as a dev-dependency of your ESB and run
php bin/console smartesb:flows:export
. This command for now assumes the name of the producer (I'm leaking a bit of information about Smartbox here :F ). You should see all the methods of the producer and the mappings calculated.Challenges
FlowExporter
gets the producers directly from the container. It gets injected the name of the producer and when building flows, it calls the container. This should be replaced with a service subscription but it's outside the scope of this ticket.eval: mapper.map(context, other_mapping)
. This tricky part around this is how to detect when a string is a simple mapping, and when a string is a submapping. Feeding it back to the string evaluator doesn't work because it will complain about the missing piece of information (context
in the example)body
, SOAP uses the keyparameters
)*.get
definitions are going to be specially tricky to emulate, as they expect an object. For example, your flow requiresbody.get('my-field-in-the-body-request')
. This currently fails with the errorCould not evaluate 'body.get('voucherId')'. Variable "body" is not valid around position 1 for expression...
because body is passed to the evaluator with all the information in the nromal flow of the application, but here body is not defined anywhere and it can be very tricky to guess what needs to be passed. This of course is outside the scope of this ticket, as we are doing outbound mappings for now, but nonetheless the command will fail in these situations.