IBM / ibm-cloud-functions-data-processing-message-hub

Create a serverless, event-driven application with Apache OpenWhisk on IBM Cloud Functions that executes code in response to messages or to handle streams of data records from Apache Kafka or IBM Message Hub.
https://developer.ibm.com/patterns/respond-messages-handle-streams/
Apache License 2.0
22 stars 26 forks source link

Dropping Package Creation and Package Binding #36

Closed pritidesai closed 7 years ago

pritidesai commented 7 years ago

Dropping package "kafka" and package binding "kafka-out-binding". Moving mhpost-action out of kafka package. Here is the new structure:

Action:         mhget-action
Action:         mhpost-action
Sequence:   kafka-sequence
Trigger:        kafka-trigger
 Rule:            kafka-inbound-rule

As a result of this movement, I had to add command line parameters to mhpost-action which were originally part of "kafka-out-binding".

I have the manifest file created with this new structure but deployment using that manifest doesn't work for two reasons:

  1. Action created with .zip file can be invoked but fails with SyntaxError, issue#273
  2. NPM install is not supported, issue#250
package:
    name: data-processing-message-hub
    namespace: _
    triggers:
        # Creating the kafka-trigger trigger"
        kafka-trigger:
            source: $KAFKA_MESSAGE_HUB_FEED
            inputs:
                isJSONData: true
                topic: $SRC_TOPIC
    actions:
        # Action named "mhget-action"
        # Creating action as a regular Node.js action
        mhget-action:
            location: actions/mhget/mhget.js
        # Action named "mhpost-action"
        # Creating action as a zipped Node.js action, as it contains dependencies
        mhpost-action:
            location: actions/mhpost/mhpost.zip
            runtime: nodejs:6
            inputs:
                api_key: $API_KEY
                kafka_rest_url: $KAFKA_REST_URL
                topic: $DEST_TOPIC
    sequences:
        # Sequence named "kafka-sequence"
        # Creating the sequence that links the get and post actions
        kafka-sequence:
            actions: mhget-action, mhpost-action
    rules:
        # Sequence named "kafka-inbound-rule"
        # Creating the rule that links the trigger to the sequence
        kafka-inbound-rule:
            trigger: kafka-trigger
            action: kafka-sequence