Hi Anusha,

Can you please followup and respond to this..

Thanks,
Mohan


On Tue, Nov 20, 2018 at 3:57 PM Bahtiyar KARANLIK <
[email protected]> wrote:

> Hi All,
>
> I'm trying to retrieve the records in a PostgreSQL table and update or
> insert them into Redis. Below code creates all KEYS in the Redis instance,
> BUT all items contain the very same record (of Threshold rule) (hgetall
> keyname1 and hgetall keyname2 returns the same result)
>
> I'm not sure if this is a bug or a feature, and stuck here.. Any advices
> are highly appreciated..
>
> best regards,
>
> define trigger ConfigReloadTrigger at every 60 sec;
>
> @Store(type = "rdbms", jdbc.url = "jdbc:postgresql://localhost/my_db", 
> username = "my_user", password = "my_pwd" , jdbc.driver.name = 
> "org.postgresql.Driver", table.name = 'pm_threshold')
> @Index('metric_name')
> @primaryKey('id')
> define table ThresholdTable(id int, created_at string, updated_at string, 
> path_regex string, aggr_field string, aggr_function string, warning double, 
> warning_action int, critical double, critical_action int, is_active bool, 
> task_step_id int, metric_name string, selectivity int);
>
> @Store(type='redis', table.name='pm_threshold', nodes='localhost:6373', 
> cluster.mode='false')
> @primaryKey('threshold_id')
> define table ThresholdCache(threshold_id string, is_active bool, path_regex 
> string, threshold_updated_at string, threshold_context object, cache_time 
> long);
>
> from ConfigReloadTrigger join ThresholdTable
> select
>     str:concat('threshold_rule_', ThresholdTable.id 
> <http://thresholdtable.id/>) as threshold_id,
>     ThresholdTable.is_active,
>     ThresholdTable.path_regex,
>     ThresholdTable.updated_at as threshold_updated_at,
>     map:create(
>         "id", ThresholdTable.id <http://thresholdtable.id/>,
>         "metric_name", ThresholdTable.metric_name,
>         "path_regex", ThresholdTable.path_regex,
>         "selectivity", ThresholdTable.selectivity,
>         "aggr_field", ThresholdTable.aggr_field,
>         "aggr_function", ThresholdTable.aggr_function,
>         "warning", ThresholdTable.warning,
>         "warning_action", ThresholdTable.warning_action,
>         "critical", ThresholdTable.critical,
>         "critical_action", ThresholdTable.critical_action,
>         "is_active", ThresholdTable.is_active,
>         "task_step_id", ThresholdTable.task_step_id,
>         "created_at", ThresholdTable.created_at,
>         "updated_at", ThresholdTable.updated_at
>     ) as threshold_context,
>     eventTimestamp() as cache_time
> insert into ThresholdTableStream;
>
> from ThresholdTableStream#log(true)
> select
>     ThresholdTableStream.threshold_id,
>     ThresholdTableStream.is_active,
>     ThresholdTableStream.path_regex,
>     ThresholdTableStream.threshold_updated_at,
>     ThresholdTableStream.threshold_context,
>     ThresholdTableStream.cache_time
> update or insert into ThresholdCache
>     set
>     ThresholdCache.threshold_id = threshold_id,
>     ThresholdCache.is_active = is_active,
>     ThresholdCache.path_regex = path_regex,
>     ThresholdCache.threshold_updated_at = threshold_updated_at,
>     ThresholdCache.threshold_context = threshold_context,
>     ThresholdCache.cache_time = cache_time
>     on ThresholdCache.threshold_id == threshold_id;
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>


-- 
*V. Mohanadarshan* | Technical Lead | WSO2 Inc. <http://www.wso2.com/> |
(M) 94-771117673 | (E) [email protected] |
GET INTEGRATION AGILE
Integration Agility for Digitally Driven Business
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to