How to read data from property file and store it in cache node in ibm mb - ibm-integration-bus

I am completely new to IBM MB, i would want to know how to read data from property file and store in cache node. I have gone through Ibm sites, i could find its possible but i do not know how to implement it. Could someone show me a sample code to read data from property file and store it in cache node and refresh it for every 1 hour.
My property file will be like
Key value
Id1 test1
Id2 test2

Check this blog post: Using the global cache in WebSphere Message Broker
This article showed a sample implementation of the new WebSphere Message Broker global cache feature in an enterprise environment to store and access reference data. The global cache is useful in many other scenarios, and you can write similar ESQL and Java routines to access the global cache depending on your requirements.

Related

Store infrequently changing info in Spring App

I am working On a Microservice (Spring boot) that require to store some static information that infrequently changes (once per quarter). The data (below) is about the company reports that looks like
reportId#1: "frequency"="daily","to":"some email ids"
reportId#2: "frequency"="weekly", "to":"some emailids"
As you can see an entry in the data is basically a Report id, and associated attributes are frequency of reports and receiver's email id.
My question is.. What is the best place to store this information? I have some thoughts..and here are my views.
a) NoSQL DB like MongoDB seems to be a good option.. I can create a Collection and store it there and retrieve it once during app startup. But the I thought, whether creating a Collection just to store this static info is a good choice?
b) Redis seems to be another good option. I can create a template for above dataset and store it there. I can query the Redis based on the reportId to retrieve the frequency and senders list.
c) Store it in a file in the classpath and load at the app startup. The downside is that, I will have to redeploy the app with new changes in file whenever this report listing changes. I believe externalizing this information to either Mongo or Redis is a better option.
d) The app is running in the AWS..so I can even store this in a file in S3 bucket.
Would like to know your views?
Since the config will only change once a quarter, the overheard of a database is not required. You should consider Apache commons configuration. It will allow you to load config changes from files without the need for an application restart.
http://commons.apache.org/proper/commons-configuration///userguide/howto_reloading.html

Disabling/Pause database replication using ML-Gradle

I want to disable the Database Replication from the replica cluster in MarkLogic 8 using ML-Gradle. After updating the configurations, I also want to re-enable it.
There are tasks for enabling and disabling flexrep in ML Gradle. But I couldn't found any such thing for Database Replication. How can this be done?
ml-gradle uses the Management API to handle configuration changes. Database Replication is controlled by sending a PUT command to /manage/v2/databases/[id-or-name]/properties. Update your ml-config/databases/content-database.json file (example that does not include that property) to include database-replication, including replication-enabled: true.
To see what that object should look like, you can send a GET request to the properties endpoint.
You can create your own command to set replication-enabled - see https://github.com/rjrudin/ml-gradle/wiki/Writing-your-own-management-task
I'll also add a ticket for making official commands - e.g. mlEnableReplication and mlDisableReplication, with those defaulting to the content database, and allowing for any database to be specified.

Storing data in CouchbaseServer(without metadata)

I have created data in couchabse lite db and replicated it in couchabse server , but in replication unused data is also get created on server. is there any method to store pure data (without metadata) ?
is bucket shodowing is usefull for this problem ?
You can use couch base server 5.1 there the extra meta data is stored in XAttrs. And the document will not have meta data inside the document. If required this meta data can be found in the X- attributes.
For that you will need to set up the sync gateway in a manner where one sync gateway out of the cluster should have import_docs:"continuous" and all the sync gateway should have enable_shared_bucket_access:true.
By this change in the sync gateway configuration by using sync gateway 1.5 or 2.0 you will be able implement this functionality.
Also the good thing is, if the data is even changed directly on the server it will also flow to the devices.

Need to Create File inbound channel adapter dynamically

I am new in spring integration. So please help me to resolve this problem.
Requirement is something like, we have multiple location from where we have to read the files and in future it can increase, location can be Any file system, so I am trying to use file inbound channel adapter to complete this requirement.
we can have multiple locations stored in our data base like pooling time and location from where we have to pool to get the files.
But if I go with xml configuration so I have to create new file inbound channel adapter every time in the xml configuration and all the details. if we want to pool that specific location to get the files. something like below -
int-file:inbound-channel-adapter id="AdapterOne" prevent-duplicates="false"
directory="${FileInputLoc}" filter="compositeFilter"
int:poller fixed-rate="${poolingTime}"
int-file:inbound-channel-adapter
int:service-activator input-channel="AdapterOne" ref="testbean"
bean id="testbean" class="com.SomeActivatorClass"
Please suggest me, how can I achieve this by code. so that based on data base row it create different channel adapter which pool at different time to different location.
Thanks,
Ashu

Good way to demo a classic ASP web site

What is the best way to save data in session variables in a classic web site?
I am maintaining a classic web site and want to be able to allow my users to demo all functionality of the site, this means allowing them to delete records.
The closet example I have seen so far are the demos of Telerik controls where they are saving the dataset in sessions on first load and allowing the user to manipulate the data.
How can I achieve the same in ASP with an MS Access backend?
If you want to persist the state over multiple pages (e.g. to demo you complete application) then it's a bit tricky.
I would suggest copying the MDB file for each session and using the copied version. This would ensure that every session uses its own data.
create a version of your access db which will be used as a fresh template for each user
on session copy the template and name it after the users session ID
use the individual MDB
Note: Then only drawback I can see here is that you need to remove the unused MDB files as it can get a lot after sometime. You could do it with a scheduled task or even on session start before you create a new one.
I am not sure what you can use to check if it's used or not but check the files creation date or maybe the LDF file can help you as well (if it does not exist = unused).
You can store a connection or inclusive an object in a session variable as far you remember what kind of variable are you storing at the retrieving time. I had never stored a dataset in a session variable but I had stored a lot of arrays in session variables so you can use the ADO Getrows method to locate a complete dataset into a session variable.
How big is the Access database? If your database is small enough (relative to the server capacity, expected number of users, and so forth) then I like the idea of using a fresh copy of the database for each user that runs the demo.
With this approach, you simplify your possible code paths. Otherwise this "are we in demo mode or not?" logic will permeate a heck of a lot of your code.
I'd do it like this...
When the user begins the demo, make a copy of the Access DB for that user to use. If your db is foo.mdb, copy it to /tempdb/foo_1234567890.mdb where 1234567890 is the user's session ID.
Alter the user's connection string to point to the fresh database copy. From this point on, your app can operate like "normal" with no further modifications.
Have a scheduled task that deletes all files in /tempdb with last-modified times more than __ hours in the past. If you don't have the ability to schedule tasks on the server (perhaps you're in a shared hosting environment, etc) then you could do this at the same time you do step #1.

Resources