-1

I want to set up viewing permissions for different users in EPL query as follows:

Users   AllowedView
U1      V1,V2
U2      V1,V3
U3      V2,V3

Input Events sequence are as:
  User View Amount
1. U1, V1,  20
2. U2, V3,  30
3. U3, V3,  40
4. U3, V2,  50

Output required as Sum(amount):
1. U1 - 20, U2 - 20 (as V1 is changed and permission to U1 & U2)
2. U2 - 50, U3 - 30 (as V3 is changed and permission to U2 & U3)
3. U2 - 90, U3 - 70 (as V3 is changed and permission to U2 & U3)
4. U1 - 70, U3 - 100 (as V2 is changed and permission to U1 & U3)

I think context will do this, but need some help to streamline the flow of events and configuring context.


So I need to Create context partitions on the basis of group of views. Such as

Partition1 - V1,V2
Partition2 - V1,V3
Partition3 - V2,V3

So that all calculation can be done on the basis of them. As you can see the partitioning key of the context is not a single or double property, it is basically a group of same property. So I can not write as

Create context TestContext 
     partition by view 
     from EventPermissibleView;
weima
  • 4,653
  • 6
  • 34
  • 55
Chaturvedi Dewashish
  • 1,469
  • 2
  • 15
  • 39

1 Answers1

0

Can a single incoming event below to multiple partitions? Perhaps a UDF is easiest that assigns a group id to each event, group id could be just the string-append of all views (sorted)

user650839
  • 2,594
  • 1
  • 13
  • 9
  • Would you please elaborate. I don't want to use java in between. Is there any way to define functions in esper epl? Will expression will do the trick? – Chaturvedi Dewashish Dec 06 '12 at 07:50