Defining various DB & Salesforce access information in an external file and using them in Mule Anypoint Studio - configuration-files

I am running Mule Anypoint studio v6.2.4 under Windows. I have an application which gets data records from a SQL Server DB and populates them into Salesforce Org. The application was developed using examples and works fine in the current scenario of one DB and one SF parameters defined in a mule.properties file. This structure works but with serious limitations. Whenever a new DB instance is provided (DEV/QA/SAT/UAT...) and a different destination SF Org is chosen, all the mule applications need to be modified as the access parameters are defined in the property file.
I asked for help about how to dynamically define and use the access parameters in this question. (Defining various DB & Salesforce access information in Mule Anypoint Studio). While the proposed solution worked, it was still based on property file approach. Hence whenever a new DB or SF Org is to be worked on, all the mule applications will still need to be changed because of the property file approach.
A correct approach will be define all the access parameters in an external file. In the mule app, retrieve the appropriate access parameters based on DB name or Org name (provided as http query parameters). Use their values to initialise appropriate mule script variables. This way new DBs or Orgs can be added at will and mule app should work without any re-compilation or changes.
My mule app is batch based and config code fragment to access SQL DB is as follows::
<db:generic-config name="legacyDB" url="jdbc:jtds:sqlserver:${dbHost}:${dbPort};databaseName=${dbName};user=${dbUser};password=${dbPassword}" doc:name="Generic DB Config"/>
How would I accomplish it so that DB or SF access works as defined? Details will help me as I am not that proficient in Mule yet.
Thanks
Kishore

What about reading an external file using a JavaClass and returning a JavaObject to Mule, then you can easily manage those values.
Check this project and change the path in the LoadExternalFile.java to load your own json file. There is an example in the src/main/resources
https://github.com/angelalberici/external-property

Related

How to pass custom java objects to Drools

I am new to Drools engine and Business rule in it. I am trying to figure out, in the Data Objects, is there any way to pass the custom objects so that using the parameters to refer in my own drl file?
I setup kie-drools-wb-650final-eap7.war on my JBoss application server. I made the server up and running and was able to login to the application. Now my question is regarding the Data Objects section. I tried to create a new Data Object and it got created. Where the newly created Data Object will be stored and is there any chance of injecting my own created objects into that.
Please help me in solving this problem.
When we setup kie-drools-wb-6.5.0.Final-eap7.war in Jboss application server and run the application, i am presented with default Data Objects like Application etc... My question is where can I find these objects stored in the application.

AWS AppFlow is not picking new tables created in db using custom connector

Using custom connector i am able to load data from mysql to s3 in AWS Appflow but when creating a new table in mysql, it is not showing up in Appflow console.
New entities are discovered during the ListEnties event that is called recursively when building a flow amd selecting the source object. Since you are building a custom connector all the logic of how the connector discovers entities is in your custom code. Specifically the list_entities method of your MetadataHandler.
See the end-to-end flow of the readme of the Python custom connector SDK. I quote part here.
https://github.com/awslabs/aws-appflow-custom-connector-python
Step 5: AppFlow user then uses that ConnectorProfile to create Flow definitions. During the flow creation AppFlow invokes listEntity and describeEntity functions on the connector to retrieve the list of supported entities and the entity detail of the specific entity AppFlow user selected on the console / API.
With that said, if you can share im your question the code of your metadata handler as well as a description of the source database and why you think the new table should be discovered by your code.
I would also look at the CloudWatch logs or whereever you store logs for the Lambda hosting your custom connector. View the logs after trying to build a flow and not seeing the expected new entities listed. If there is an error trying to read a new entitiy you could see it here if you have the proper logging setup.

How to create/insert product programmatically in Websphere Commerce 7 WCS7

I'm developing an ecommerce based on Websphere Commerce 7 WCS7. I need to import products from an external supplier, which is exposing a webservice. I've already implemented a Controller Command performing all the operation needed to extract the products from the remote service, and I've them avalaible as custom Java classes.
I'm a little bit confused about the approach I should follow in this case. I've defined the attributes needed in my scenario and used the dataload utility to import them in the DB. What should I do next? I expect to be able to "create" WCS product programmatically from my Controller Command but I don't know how to use the attribute I've defined in a programmatic insert.
Can someone point me on the right track on how to perform this kind of operation? I went through the documentation, but, given the fact I'm quite new of the WCS environment, I don't know how to proceed according to the current best practices.
It is possible to create a new catalog entry programmatically if you copy what is being done in the LOBTools. I have not done this myself though. I have always added new products via the data loads and when we did need to add from an external service I just output the information to a file and loaded along with our other products. The reason was due to keeping the catalog in sync with the product management system.
Have a look at the various DataBean classes in WCS, like: CatalogEntryDataBean.
See here for WCS data beans:Link
And here for "activation" of a DataBean:Link

Run multiple sites on the same GWT application

Can someone please point me to the right direction.
I need to be able to host my GWT application in a way that it allows multiple clients to use the same application which could be separated by url's but internally using the same application.
the different sites would probably be seperated by different configurations. eg. different database, different log path etc, etc,
any ideas.?
You could use the following way to arrange your projects :
- my.application.core.project : it holds all the business logic and views for the application except for the entry point
-my.application.customerX.project : it holds only the entry point and the property files used for having the connection to the db, probably customerX specific theme
-my.application.customerY.project : it holds only the entry point and the property files used for having the connection to the db, probably customerY specific theme
Such an organization of the projects would allow you to have a common core that is distributed to each of the customers and also the ability to build on top of the core customer-specific impelementations.
The url's per client can be done with URL rewriting. Be it with an apache server in front of your application and/or in combination with a Filter in your web application.
As for the configuration, logging, and/or database per client you want a solution that doesn't store a file per client on the file system next to your application. Preferable you store client specific settings in one database and have an admin interface to manage it. For the client's data you also don't want a separate database per client, because it doesn't scale well, and would be a maintenance mess if you need to upgrade your application and databases to a newer version. Look for a multitenant architecture.
I admit this is a vague answer, but without specific system and software descriptions it's kind of hard to give a concrete answer. Nevertheless I hope this answer does give you some direction.
I have successfully achieved this by setting up separate directories in tomcat for different clients and then creating soft-links to the main application within that folder. when it comes to database connection properties and other configuration properties, instead of pointing them to the main application I just created them separately.

Visual Studio 2012 Group Solution need individual connection strings per developer

We have a project that is being worked on currently by 5 developers and could get more at any time. The developers are located at different places in the US. Our back end is Code First Entity Framework based on a SQL Server database.
Some of the developers have SQL Server Express and some have full blown SQL Server. We need a way to have the solution everyone works on but each developer needs to have his own connection string to the data so they can connect to their individual instances. We cant use localhost because express versions have named instances of SQLEXPRESS.
We could just change the connection string when we grab the code form Git but then every time we sync we will have conflicts to merge so that would be a pain.
Has anyone run into this?
A very simple solution would be to have everyone use SQL Server Express or SQL Server Developer Edition. You can install both side-by-side, so that should not be an issue. Especially since SQL Express is free...
Another option is to define a SQL Server Connection Alias on each client with a predefined name. Then add the alias to your .config. That way the SQL Client will resolve to the right database and you can define one static value in your .config.
The 3rd solution is to add a configsource="connectionstrings.config" and create these files on the local workspace, but don't check them in. You can add a connectionstrings.template.config and check that in to provide a starting point. These files don't need to be part of the solution.
The 4th option is to store the connectionstring in a .Settings file, set it to user and use the standard configuration API to store the connectionstring in the application settings folder of the users profile. You'll need to pass the connectionstring to the constructor of the Context class.