Common Data Model with wso2bps and wso2greg - wso2

I am evaluating wso2 and came across the following issue: imagine that my company already has a well defined Common Data Model for their business. Those schemas (and even service definitions - wsdls) live on a repository and references between files are done using relative paths between them. Now, what I want is to import all of these XSD's and WSDL's into wso2 Gorvernance Registry (wso2greg) to make it manage them. More (and this is where I start to lose the grip on wso2) I want to reference wso2greg's resources on wso2bps's BPEL Workflows. I want to say: "Hey, workflow! Forget all about your auto-generated interface. Your interface will be this one {wsdl_from_wso2greg}."
I am trying to accomplish this by creating an Registry Resources Project inside my "main" Carbon Application Project (along-side with my BPEL Workflow) and then creating PartnerLinks on the workflow but, after I configured everything, I get the following error: "The import location of ../TestGreg/TestServiceWsdl.wsdl is not supported by this implementation. Import artifacts must be contained within the folder hierarchy that has the deployment descriptor at the root".
Now, am I doing something really stupid or wso2 really does not support what I am trying to do? If so, how do you guys usually deal with these issues?
Thks,
Leandro Nunes

When you are referring to WSDLs/XSDs from BPEL, you need to package them with BPEL. You cannot refer the ones stored in the registry.
Referring from the external registry can be done only for security policies and endpoint references. Any other resources need to be packaged with the BPEL.

Related

Dynamic database connection in Symfony 4

I am setting up a multi tenant Symfony 4 application where each tenant has it's own database.
I've set up two database connections in the doctrine.yaml config. One of the connections is static based on an env variable. The other one should have a dynamic URL based on a credential provider service.
doctrine:
dbal:
connections:
default:
url: "#=service('provider.db.credentials').getUrl()"
The above expression "#=service('provider.db.credentials').getUrl()" is not being parsed though.
When injecting "#=service('provider.db.credentials').getUrl()" as argument into another service the result of getUrl() on the provider.db.credentials service is injected. But when using it in the connection configuration for doctrine the expression is not being parsed.
Does anyone have an idea how to solve this?
You're trying to rely on ability of Symfony services definition to use expressions for defining certain aspects of services. However you need to remember that this functionality is part of Dependency Injection component which is able (but not limited to) to use configuration files for services. To be more precise - this functionality is provided by configuration loaders, you can take a look here for example of how it is handled by Yaml configuration loader.
On the other hand configuration for Doctrine bundle, you're trying to use is provided by Config component. A fact that Dependency Injection component uses same file formats as Config component do may cause an impression that these cases are handled in the same way, but actually they're completely different.
To sum it up: expression inside Doctrine configuration does not work as you expecting because Doctrine bundle configuration processor doesn't expect to get an Expression Language expression and doesn't have support for handling them.
While explanations given above are, hopefully, answers your question - you're probably expecting to get some information about how to actually solve your problem.
There is at least 2 possible ways to do it, but choosing correct way may require some additional information which is out of scope of this question.
In a case if you know which connection to choose at a time of container building (your code assumes that it is a case, but you may not be aware about it) - then you should use compiler pass mechanism yo update Doctrine DBAL services definitions (which may be quite tricky). Reason for this non-trivial process is that configurations are loaded at the early stages of container building process and provides no extension points. You can take a look into sources if necessary. Anyway, while possible, I would not recommend you to go in this way and most likely you will not need it because (I suppose) you need to select connection in runtime rather then in container building time.
Probably more correct approach is to create own wrapper of DBAL Connection class that will maintain list of actual connections and will provide required connection depending on your application's logic. You can refer to implementation details of DBAL sharding feature as example. Wrapper class can be defined directly through Doctrine bundle configuration by using wrapper_class key for dbal configuration

Using Serverless framework on monorepo of multiple services with shared code

I have a pythonic serverless project on AWS, in which several services are contained in a single repository (a monorepo) which looks like:
/
serverless.yml
/service1
lambda_handler.py
/service2
lambda_handler.py
/general
__init__.py
utils.py
'general' is a package that is shared between different services, and therefore we must use a single 'serverless.yml' file at root directory (otherwise it won't be deployed).
We have two difficulties:
A single 'serverless.yml' may be too messy and hard to maintain, and it prevents us from using global configuration (which may be quite useful).
Deplyoing a single service is complicated. I guess that 'package' feature may help but I'm not quite sure how to use it right.
Any advise or best practices to use for this case?
Its better to use individual serverless.yml files per each service. To use the shared code,
You can convert the code into a library and use it as a dependency and installed via a package manager for each individual service similar to a library. (This is useful since updating a version of common code won't affect the other services)
Keep the shared code in a different repository and use git submodule for individual service.
For more information, refer the article Can we share code between microservices which I have originally written considering serverless.

WSO2 ESB (or EI) Best practice for managing environment specific variables

In some of my application I have to manage environment specific attributes / variables like:
- folder path
- rest api urls
- credentials
- ...
At the moment I'm manually setting variables in the configuration registry of each server. This is quite heavy when you've to deploy a new server because you've to recreate everything manually (I haven't find a way to initialize the repository from an xml file for instance)
I've seen different approaches like
- writing different version of the endpoints, sequences,... and create different car for distribution on each environment
- Using local registry with different entries
- Using governance registry (I've no experience with this)
What is according to you the best approach for this?
Thanks for helping
You can find the best practices guide for WSO2 Enterprise Integrator (ESB, DSS, BPS and MB) at [1]. It also explains how to manage environment specific variables.
[1] https://docs.wso2.com/display/EI611/WSO2+Enterprise+Integrator+Best+Practices
Finally what I've done (and what is working since some weeks now) is for each of my project :
Create a "master" maven project that will contain:
An ESB project
One registry project per environment that contains all environment dependant variables (like hosts, passwords, paths, ...)
One Composite Application project per environment that will package the ESB project with the correct registry values (Note that if you deploy everything in the ESB event the registry project must be considered as a "EnterpriseServiceBus" Role)
Next step will be to integrate everything in jenkins and automatize the building of car with maven.

Get the names of artifacts inside a group from Nexus repository

I want to get all the artifact names on a particular group name in my nexus repository.
I have tried lucene web api for this. like i used a url like,
http://localhost:8080/nexus/service/local/lucene/search?g=my.group.name
But on the xml response I see the it is listed the artifact from index section, which contains the deleted artifacts also. I don't want the deleted artifact names.
How can I achieve this. Is there any we api supports this?
You can write a small plugin to retrieve the GAV's. The "crawling" example from this location does pretty much what you need already:
https://github.com/sonatype/nexus-example-plugins/
The ArtifactDiscoveryListener.java is called for every GAV in a repository. The plugin contributes a scheduled task, so it's easy to run.
You can find more information about developing plugins here:
https://books.sonatype.com/nexus-book/reference/plugdev.html

What GUI tool can I use for building applications that interact with multiple APIs?

My company uses a lot of different web services on daily bases. I find that I repeat same steps over and over again on daily bases.
For example, when I start a new project, I perform the following actions:
Create a new client & project in Liquid Planner.
Create a new client Freshbooks
Create a project in Github or Codebasehq
Developers to Codebasehq or Github who are going to be working on this project
Create tasks in Ticketing system on Codebasehq and tasks in Liquid Planner
This is just when starting new projects. When I have to track tasks, it gets even trickier because I have to monitor tasks in 2 different systems.
So my question is, is there a tool that I can use to create a web service that will automate some of these interactions? Ideally, it would be something that would allow me to graphically work with the web service API and produce an executable that I can run on a server.
I don't want to build it from scratch. I know, I can do it with Python or RoR, but I don't want to get that low level.
I would like to add my sources and pass data around from one service to another. What could I use? Any suggestions?
Progress DataXtend Semantic Integrator lets you build WebServices through an Eclipse based GUI.
It is a commercial product, and I happen to work for the company that makes it. In some respects I think it might be overkill for you, as it's really an enterprise-level data mapping tool for mapping disparate data sources (web services, databases, xml files, COBOL) to a common model, as opposed to a simple web services builder, and it doesn't really support your github bits, anymore than normal Eclipse plugins would.
That said, I do believe there are Mantis plugins for github to do task tracking, and I know there's a git plugin for Eclipse that works really well (jgit).
Couldn't you simply use Selenium to execute some of this tasks for you? Basically as long as you can do something from the browser, Selenium will also be able to do. Selenium comes with a language called "selenese", so you can even use it to programmatically create an "API" with your tasks.
I know this is a different approach to what you're originally looking for, but I've been using selenium for a number of tasks, and found it's even good to execute ANT tasks or unit tests.
Hope this helps you
What about Apache Camel?
Camel lets you create the Enterprise Integration Patterns to implement routing and mediation rules in either a Java based Domain Specific Language (or Fluent API), via Spring based Xml Configuration files or via the Scala DSL. This means you get smart completion of routing rules in your IDE whether in your Java, Scala or XML editor.
Apache Camel uses URIs so that it can easily work directly with any kind of Transport or messaging model such as HTTP, ActiveMQ, JMS, JBI, SCA, MINA or CXF Bus API together with working with pluggable Data Format options.