Distributing events
Added by IBM contributorIBM | Edited by Claudia R Elbourn on June 9, 2015
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

It is possible to target events at users other than the currently identified targets stream. This allows for efficient distribution of events to a number of parties. It should be noted that this facility will only work if the administrator of the system has enabled event distribution for the user making the call. To allow distribution of events, the administrator of the system must specify the right users in the trustedExternalApplication J2EE role of the WidgetContainer application. For instructions on how to assign users to roles, please see: [[http://www-10.lotus.com/ldd/lcwiki.nsf/dx/Roles_ic45|Roles]]

Types of distribution

 

Where you have access to a stream you can directly target a stream when posting an event


POST to /activitystreams/@me/@all


However IBM Connections does not generally allow direct access to another users stream except in the following cases:

  • The public stream : /activitystreams/@public/@all
  • A community Stream : /activitystreams/[CommunityId]/@all


This means than the event would have to be sent separately to each user that is to receive the event. In order to ensure that this can be done more efficiently, an extension to the the Open Social spec allows for a few means of distribution in the data model

  • 'deliverTo' is used for specifically targeted users, corresponding to those events that would appear in the responses part of the News UX


This mechanism however is currently expected to be superseded by a set of 4 fields with greater flexibility

  • 'to' is also used for specifically targeted users, corresponding to those events that would appear in the responses part of the News UX
  • 'bto' is the same but is removed from any retrieval (connections uses this model)
  • 'cc' is used for events where a user is typically following an object
  • 'bcc' is the same but is removed from any rerieval (connections uses this model)

At the moment IBM Connections supports the following mechanisms

  • 'deliverTo'
  • 'to'

However in no case do we return the distribution list back to a receiving user (it's used for distribution only)

Restrictions on distribution


By default most users do not have the authority to distribute events to another users stream. If they did then this would mean that any user would have the ability to spam indiscriminately. Although the ability to distribute can be opened up via configuration to any user, there is some basic distribution allowed for any user.

  • To [UserID] where the user in question is the current user
  • To @me which resolves to the same thing
  • To @public which means the event will appear on everyones discovery tab - but this is only permitted if the submitting user is also the actor in the event
  • To [CommunityId] where the current user is a member of that community or the community is public - again this is only permitted if the submitting user is also the actor in the event


Using 'deliverTo'


deliverTo is enclosed in the openSocialContainer and contains an array of objects of type person.
 

{

openSocial : {

"deliverTo":[

{"objectType":"person",

"id":"tag:example.org,2011:jane"}

]

},

"verb":"post",

"actor":{

"objectType":"person",

"id":"tag:example.org,2011:jane"},

"object":{

...

}

}



Using 'to'


'to' is in the root of the event but follows the same general format
{

"to":[

{"objectType":"person",

"id":"tag:example.org,2011:jane"}

],

"verb":"post",

"actor":{

"objectType":"person",

"id":"tag:example.org,2011:jane"},

"object":{

...

}

}