Where are stream definitions in WSO2CEP 3.0.0 stored? - wso2

I could not find where the description of the streams defined via UI are stored? Are they stored on h2 database or in an xml file? If the answer is file, where this file is located?

Stream definitions are stored in the embedded registry of the CEP server. You can access this via the registry UI. But it is not recommended to edit registry definitions in this manner.
If you want certain stream definitions to be available at the time of starting the server, you can define them in the XML file /repository/conf/stream-manager-config.xml. However, please note that this file will be read only at server startup and there is no hot deployable feature available for stream definitions currently. You can refer to the following link [1] for more information.
[1] http://docs.wso2.org/display/CEP300/Working+with+Event+Streams

Related

Client application for Corda

I am making a springboot application which will be act like a client for corda layer.
For doing this I have to put my contracts jar and workflows jar in my client application.
Is it safe from safety aspects or this approach is correct?
Any another alternative without giving contracts and workflows jar.
When you build the clients module, it will fat-jar all of the dependencies (including your CorDapps) into the jar file of your SpringBoot app (i.e. webserver).
It's safe, because if you give some party the webserver jar file and they extract your CorDapp jar files from it; they won't be able to transact with your nodes if they're not part of your network.
And if they are part of your network, then it shouldn't be a problem that they received that jar file; because most likely they already have the CorDapps that are part of it.
Maybe they are part of your network, but they should have only a certain sub-set of your CorDapps (i.e. they should be able to run only certain flows); then your workflows and contracts should have some validations inside of them that restrict certain actions to certain parties.
For example, you can create a custom configuration file (see here how); and inside that file you specify the entity that can be the issuer of your tokens. Then inside your flow you fetch that value from the file and compare getOurIdentity() with the fetched value, if they mismtach then you throw an exception.
Another example, you can put a list of parties as black-listed entities in a jar or zip file then upload that file to your node. Inside your flow you can add that file as an attachment to your transaction, then inside your contract, you can fetch that file and read its contents to find out if one of the participants is on the black-listed entities list or not. See example here.

WSO2 IS: claim-config.xml - Is it read only once, or every time the server is started up?

The WSO2 IS documentation reads:
"The claim dialects configured in /repository/conf/claim-config.xml file get applied only when you start the product for the first time, or for any newly created tenants. With the first startup, claim dialects and claims will be loaded from the file and persisted in the database. Any consecutive updates to the file will not be picked up and claim dialects and claims will be loaded from the database."
Does this mean claim-config.xml is a file to seed the database and is only run once? If it is only for seeding the database, that means the only way to update claims after the very first start of the server is to edit the database directly or update claims via the console, correct?
I'm trying to figure out the best way to update my claims for service providers in WSO2 IS.
I discovered that the claim-config.xml is only run once. After the database is seeded, the file is not read anymore. Subsequent changes to the claim configuration are written to the WSO2CARBON_DB file which is located at WSO2_INSTALL_LOCATION\repository\database
When WSO2 IS starts in the first time, or when creating a new tenant It reads the claim-config.xml file and populates the claims into the database. Then you can manage the claims as below methods,
From management console. Please refer the documentation [1] for more
details.
Using ClaimMetadataManagementService. Please refer the
documentation [2] for more details.
[1] https://docs.wso2.com/display/IS570/Configuring+Claims
[2] https://docs.wso2.com/display/IS570/Managing+Claims+with+APIs

Solutions within WSo2 ESB for Processing Zip files

I have the following requirement :
“Copy a Zip file from a sftp server to a directory on a local server, then unzip the file and extract 2 Xml files from inside it to process in our message service we have setup within our ESB.”
I have done some several searches over the past week on the internet, as well as read several topics in the Wso2 documentation but I cannot find a clean way to implement this requirement. I found this question asked on stackoverflow already - https://stackoverflow.com/questions/27806557/wso2-esb-extracting-and-processing-zip-files
However, I did not see where there were any suggestions/solutions provided. My first thought is to build a sequence with a class mediator to handle the extraction of the 2 xml files I need from the zip file, but maybe there is a better approach?
Is there any recommendations, links, or other references that folks could provide or suggest that would help me move forward with implementing this requirement? Or is this something I will need to handle outside of ESB via script with cron control?
Please kindly note that I'm assuming that you are using ESB 4.8.1
Since this is a specific requirement we don't have an out of the box solution for your scenario. However, you can easily do this using WSO2's VFS transport and a custom class mediator. The procedure would be:
Read your zip file using VFS Transport and save it in your local server.
Next, create a class mediator which unzip your zip file and then read your XML files. For more details about how to write a class mediator please refer Class Mediator.
If you need more help regarding this issue please let me know.
Thanks,
Upul
In the newer version of the ESB, the File Connector supports zip/unzip operations: https://docs.wso2.com/display/ESBCONNECTORS/Working+with+the+File+Connector+Version+2

WSO2 CEP STREAMS

I create input and output streams in my WSO2 CEP (v3.1.0) with event formatter and event builder as well. I need to find out where this streams are created in WSO2 CEP catalog structure, becasue I can't find it beyond event builder and formatter (wso2cep-3.1.0\repository\deployment\server).
Has anyone know where I can find this streams files?
Kacu
I managed to load streams via xml (only during startup), by modifying the stream-definitions.xml file in this folder wso2cep-3.1.0/repository/conf/data-bridge.
You can take a look at this page in the documentation for more details, just keep in mind that the location written in the documentation doesn't match what I found in the server.
In CEP 3.1.0, event streams are stored in the registry (which comes with CEP), it is not stored in filesystem. Streams can be located under governance section of the registry (See streamdefinitions sub directory)..
Regards,
Mohan

Automated deployment of DSS datasource configuration

We have a "mavenized" project with several containers (wso2esb, wso2dss, tomcat) and many components to deploy to them.
We are trying to find a way to deploy the datasource configuration for all our DSS services but I notice it is stored in its own DB (H2).
Do you know if there is any way to declare something like a XML file in order to create the datasource in the DSS in an automated way?
I tried to see the documentation but did not find anything useful for automatic deployment (meaning without using the admin pages).
Yeah, you can use the Carbon data source configuration file datasources.properties, to provide this information. This file should be located at $SERVER_ROOT/repository/conf.
A sample for this configuration file can be found in BPS sources.
After the data sources are defined using this, you can use them using the data source type "carbon data source" from data services.
You can easily deploy artifacts with the hot deployment functionality in WSO2 Servers by simply copying them to a specific directory in the server.
For Data Services Server you can copy the dbs files (in your case with the help of Maven) to $WSO2DSS_HOME/repository/deployment/server/dataservices dirctory. Similarly for BPELs its $WSO2BPS_HOME/repository/deployment/server/bpel
For CAR files created with carbon studio, its $WSO2CARBON_HOME/repository/deployment/server/carbonapps.
For ESB configs, its $WSO2ESB_HOME/repository/deployment/server/synapse-configs.