Nav

To Configure Multiple Workers (Nov 2017 and Jul 2017)

In a CloudHub multi-worker environment, you need to ensure that all workers can validate the OAuth token issued to a particular worker. You also configure the idempotent filter to stop duplication of the token on those workers. The token store by default uses an in-memory object store that is not shared between the workers in a Cloudhub deployment. A reference to the _defaultUserObjectStore implements the object store provided by CloudHub such that all workers share this object store.

  1. In the OAuth provider app configure the object store:

    
                
             
    1
    2
    3
    4
    5
    6
    7
    8
    9
    
        <spring:bean name="tokenStore" class="org.mule.modules.oauth2.provider.token.ObjectStoreTokenStore">
            <spring:property name="refreshTokenObjectStore" ref="_defaultUserObjectStore" />
            <spring:property name="accessTokenObjectStore" ref="_defaultUserObjectStore" />
        </spring:bean>
    
            <oauth2-provider:config name="external-oauth2-provider"
                    ...
                    tokenStore-ref="tokenStore">
            </oauth2-provider:config>
  2. Add the idempotent filter configuration to your application:

    
                
             
    1
    2
    3
    
    <idempotent-message-filter idExpression="#[message:id]" throwOnUnaccepted="true" storePrefix="someprefix" >
      <spring-object-store ref="_defaultUserObjectStore"/>
    </idempotent-message-filter>

After deployment, all workers share, but do not duplicate, the same token store.

In this topic: