Home

 

Administer community queued events

Use the CommunitiesQEventService commands to administer the life-cycle events that occur within a community.


To use administrative commands, use wsadmin. See Start wsadmin for details.


When a community member makes a change in a community, for example, if they add a new feature to the community or change the privacy level of the community, remote applications can choose to be notified of this change by an event. If the remote application is unavailable or is otherwise unable to process the event, the event is stored in a queue. When the IBM WebSphere Application Server scheduler runs the LifeCycleRetryQueuedEvents task, the event is processed. However, if, for some reason, you don't want to wait for the scheduled task, you can manage these queued events manually by running the CommunitiesQEventService commands.

To administer the queued events associated with a community...

  1. Start wsadmin so that you can access the Communities configuration files.

    1. Access the Communities configuration files:

      If you are asked to select a server, you can select any server.

  2. Use the following commands to administer queued events.

    • To retrieve a list of the events currently queued for processing, use the following commands:


      CommunitiesQEventService commands for listing queued events

      Option Description
      CommunitiesQEventService.viewQueuedEventsSummary() Lists a summary of all of the events that are currently queued for processing.
      CommunitiesQEventService.viewQueuedEventsByResourceType(String resourceType, HashMap lastEvent, int maxRows) Lists queued events with the specified resource type, where:

      • resourceType is the string "community"

      • lastEvent specifies the last row of the previous batch. This is a HashMap object. To obtain the first batch, specify None.

      • maxRows is the number of rows to be retrieved and viewed with a single command. Use maxRows when there is a large number of rows, 200, for example, to break up both the database reads and the display into batches.

      For example:

        CommunitiesQEventService.viewQueuedEventsByResourceType("community", None, 100)
        

      This command returns a HashMap that is the last viewed row. When there are no more rows, the value None is returned. This makes it straightforward to loop over all rows a few rows at a time. For example, you might use the following Jython code to display all queued events of resourceType community in batches of 10 when there are 200 events:

        lastRow = CommunitiesQEventService.viewQueuedEventsByResourceType(“community”, None, 10) while (lastRow != None) lastRow = CommunitiesQEventService.viewQueuedEventsByResourceType(“community”, lastRow, 10)
        

      CommunitiesQEventService.viewQueuedEventsByResourceId(String resourceType, String resourceId, HashMap lastEvent, int maxRows) Lists queued events with the specified resource type and resource ID, where:

      • resourceType is the string "community"

      • resourceId is the communityUuid. This is a string.

      • lastEvent is a HashMap object

      • maxRows is the number of rows to be retrieved and viewed with a single command. Use maxRows when there is a large number of rows, 200, for example, to break up both the database reads and the display into batches.

      This command returns a HashMap, which is the last viewed row. When there are no more rows, the value None is returned. This makes it straightforward to loop over all rows a few at a time. For example, you might use the following Jython code to display all queued events of resourceType "community" and resourceId b46300c7-7837-4ba3-b26b-3fcf67a75bba, in batches of 10 when there are 200 entries:

        lastRow = CommunitiesQEventService.viewQueuedEventsByResourceId(“community”, None, b46300c7-7837-4ba3-b26b-3fcf67a75bba, 10) while (lastRow != None) lastRow = CommunitiesQEventService.viewQueuedEventsByResourceId(“community”, None, b46300c7-7837-4ba3-b26b-3fcf67a75bba, 10)
        

      CommunitiesQEventService.viewQueuedEventsByRemoteAppDefId(String remoteAppDefId, HashMap lastEvent, int maxRows) Lists queued events associated with the specified remote application ID, where:

      • remoteAppDefId is one of the following: Activities, Blog, Files, Wiki. The first character in the string must be formatted in uppercase.

      • lastEvent specifies the last row of the previous batch. This is a HashMap object. To obtain the first batch, specify None.

      • maxRows is the number of rows to be retrieved and viewed with a single command. Use maxRows when there is a large number of rows, 200, for example, to break up both the database reads and the display into batches.

      This command returns a HashMap that is the last viewed row. When there are no more rows, the value None is returned. This makes it straightforward to loop over all rows a few at a time. For example:

        CommunitiesQEventService.viewQueuedEventsByRemoteAppDefId("Blog", None, 100)
        

      Thus, to display all queued events of resourceType "community" in batches of 10, when there are 200 entries, you might code in Jython:

        lastRow = CommunitiesQEventService.viewQueuedEventsByRemoteAppDefId(“Activities”, None, 10) while (lastRow != None) lastRow = CommunitiesQEventService. viewQueuedEventsByRemoteAppDefId(“Activities”, lastRow, 10)
        

    • Use the following commands to retry events that have failed to process:


      CommunitiesQEventService commands for retrying queued events

      Option Description
      CommunitiesQEventService.retryQueuedEventsByResourceType(String resourceType) Retries queued events with the specified resource type, where resourceType is a string. The value of resourceType is always "community".

      The return value is either 1 or 0. 1 indicates success; 0 indicates failure. For example:

        CommunitiesQEventService.retryQueuedEventsByResourceType("community")
        

      CommunitiesQEventService.retryQueuedEventsByResourceId(String resourceType, String resourceId) Retries queued events with the specified resource type and resource ID, where resourceType and resourceId are both strings.

      The return value is either 1 or 0. 1 indicates success; 0 indicates failure. For example:

        CommunitiesQEventService.retryQueuedEventsByResourceId("community", "e952cf0c-a86c-4e26-b1e0-f8bf40a75804")
        

      CommunitiesQEventService.retryQueuedEventsByRemoteAppDefId(String remoteAppDefId) Retries queued events with the specified associated application ID, where remoteAppDefId is one of the following: Activities, Blog, Files, Wiki. The first character of the string must be formatted in uppercase.

      The return value is either 1 or 0. 1 indicates success; 0 indicates failure. For example:

        CommunitiesQEventService.retryQueuedEventsByRemoteAppDefId("Wiki")
        

    • Use the following commands to clear the queue of events waiting to be processed. For example, if your organization has communities that have activities associated with them and you uninstall the Activities feature from your deployment, you need to purge Activities events so that they aren't perpetually retried. Use these commands with care.


      CommunitiesQEventService commands for clearing queued events

      Option Description
      CommunitiesQEventService.clearQueuedEventsByResourceType(String resourceType) Clears queued events with the specified resource type, where resourceType is a string.

      The return value is the number of events that were cleared. For example:

        CommunitiesQEventService.clearQueuedEventsByResourceType("community")
        

      CommunitiesQEventService.clearQueuedEventsByResourceId(String resourceType, String resourceId) Clears queued events with the specified resource ID, where resourceType and resourceId are both strings.

      The return value is the number of events that were cleared. For example:

        CommunitiesQEventService.clearQueuedEventsByResourceId("community", "e952cf0c-a86c-4e26-b1e0-f8bf40a75804")
        

      CommunitiesQEventService.clearQueuedEventsByRemoteAppDefId(String remoteAppDefId) Clears queued events with the specified associated application ID, where remoteAppDefId is one of the following: Activities, Blog, Files, Wiki. The first character of the string must be formatted in uppercase.

      The return value is the number of events that were cleared. For example:

        CommunitiesQEventService.clearQueuedEventsByRemoteAppDefId("Wiki")
        

      CommunitiesQEventService.clearQueuedEventByEventId(String eventId) Clears queued events with the specified event ID, where eventId is a string.

      The return value is the number of events that were cleared. For example:

        CommunitiesQEventService.clearQueuedEventsByEventId("2d93497d-065a-4022ae25-a4b52598d11a")
        

 

Example

Here are some examples of queued event commands and their output.viewQueuedEventsSummary()

viewQueuedEventsByResourceType

viewQueuedEventsByRemoteDefAppId

viewQueuedEventsByRemoteAppDefId

viewQueuedEventsByRemoteAppDefId

viewQueuedEventsByResourceId


Administer remote applications

 

Related tasks

Manage scheduled tasks


+

Search Tips   |   Advanced Search