Messages from the Grouper messaging system from a queue can be read by Grouper and treated like a web service call.
Hook up grouper WS to read from a queue:
grouper-ws.properties
# there can be multiple entries, "wsMessagingBridge" is the name of this one, change that for each config section # the messaging system name must correspond to a messaging system in the grouper.client.properties grouper.webservice.messaging.wsMessagingBridge.messagingSystemName = grouperBuiltinMessaging # the queue or topic to check grouper.webservice.messaging.wsMessagingBridge.queueOrTopicName = sampleWsMessagingQueue # if this is a "queue" or "topic", generally it will be queue grouper.webservice.messaging.wsMessagingBridge.messageQueueType = queue # the source id of the source of the user to act as grouper.webservice.messaging.wsMessagingBridge.actAsSubjectSourceId = g:isa # the subject id of the user to act as grouper.webservice.messaging.wsMessagingBridge.actAsSubjectId = GrouperSystem # the number of seconds between checking the queue or topic grouper.webservice.messaging.wsMessagingBridge.secondsBetweenChecks = 0 # the long polling seconds, listen to the queue for this many seconds for messages grouper.webservice.messaging.wsMessagingBridge.longPollingSeconds = 20 |
That will cause all WS servers to listen on a queue or topic for messages
{ "grouperHeader": { "messageVersion": "1", //mandatory "timestampInput": "2017-07-23T18:25:43.511Z", //timestamp message sent, mandatory "type": "grouperMessagingToWebService", //says what type of message, mandatory "endpoint": "WsRestAddMemberRequest", //which endpoint, mandatory, matches the container name below "messageInputUuid": "abc123", //for logging, mandatory, make up a uuid "replyToQueueOrTopicName": "someQueue", //if replying, optional "replyToQueueOrTopic": "queue", //if replying, "queue" or "topic", optional "httpMethod": "PUT", //http method that would be in WS, mandatory "httpPath": "http://locahost:8085/grouper-ws/servicesRest/v2_2_000/groups" //http path that would be in the WS, mandatory }, // this is simply the json body of any grouper json web service normal or lite "WsRestAddMemberRequest":{ "subjectLookups":[ { "subjectId":"test.subject.0", "subjectSourceId":"jdbc" } ] , "wsGroupLookup":{ "groupName":"test:testGroup" } } } |
If there is a "reply to", then this is the message that will be sent
{ "grouperHeader": { "messageVersion": "1", //mandatory "timestampInput": "2017-07-23T18:23:43.511Z", //timestamp message input sent, mandatory "timestampOutput": "2012-07-23T18:25:45.511Z", //timestamp message putput sent, mandatory "type": "grouperMessagingFromWebService", //says what type of message, mandatory "endpoint": "WsRestAddMemberRequest", //which endpoint, mandatory, matches input container "messageInputUuid": "abc123", //for logging, mandatory, matches the input uuid "httpResponseCode": 201, //http response code that would have been sent over WS, mandatory "httpHeader_X-Grouper-resultCode": "SUCCESS", //http header that would have been sent over WS, mandatory "httpHeader_X-Grouper-success": "T", //http header that would have been sent over WS, mandatory "httpHeader_X-Grouper-resultCode2": "NONE" //http header that would have been sent over WS, mandatory }, // this is simply the json body of any grouper json web service normal or lite "WsAddMemberResults":{ "responseMetadata":{ "millis":"120", "serverVersion":"2.2.0" }, "resultMetadata":{ "resultCode":"SUCCESS", "resultMessage":"Success for: clientVersion: 2.2.0, wsGroupLookup: WsGroupLookup[pitGroups=[],groupName=test:testGroup], subjectLookups: Array size: 1: [0]: WsSubjectLookup[subjectId=test.subject.0,subjectSourceId=jdbc]\n\n, replaceAllExisting: false, actAsSubject: null, fieldName: null, txType: NONE, includeGroupDetail: false, includeSubjectDetail: false, subjectAttributeNames: null\n, params: null\n, disabledDate: null, enabledDate: null", "success":"T" }, "results":[ { "resultMetadata":{ "resultCode":"SUCCESS", "success":"T" }, "wsSubject":{ "id":"test.subject.0", "name":"my name is test.subject.0", "resultCode":"SUCCESS", "sourceId":"jdbc", "success":"T" } } ] , "wsGroupAssigned":{ "displayExtension":"testGroup", "displayName":"test:testGroup", "extension":"testGroup", "idIndex":"10000", "name":"test:testGroup", "typeOfGroup":"group", "uuid":"81cb5aa761fb477ca152738691a93e8b" } } } |
The grouper client could be run with a flag that runs as a message instead of WS. This could help with testing, debug, etc.