wttrin source wttr.in Source

Provided by: "Apache Software Foundation"

Support Level for this Kamelet is: "Stable"

Get weather forecasts from the wttr.in weather forecast service

Configuration Options

The following table summarizes the configuration options available for the wttrin-source Kamelet:

Property Name Description Type Default Example

output

Output Type

The type of output.

string

current

current, weather, full

period

Period

The interval between fetches to the wttr.in service in milliseconds.

integer

60000

wttrLanguage

Language

The language to use for displaying weather forecasts.

string

am ar af be bn ca da de el et fr fa hi hu ia id it lt mg nb nl oc pl pt-br ro ru ta tr th uk vi zh-cn zh-tw

wttrLocation

Location

The location to get weather forecasts.

string

"paris", "~Eiffel+tower", "Москва", "muc", "@stackoverflow.com", "94107", "-78.46,106.79"

Dependencies

At runtime, the wttrin-source Kamelet relies upon the presence of the following dependencies:

  • camel:core

  • camel:http

  • camel:jackson

  • camel:jsonpath

  • camel:kamelet

  • camel:timer

Camel JBang usage

Prerequisites

  • You’ve installed JBang.

  • You have executed the following command:

jbang app install camel@apache/camel

Supposing you have a file named route.yaml with this content:

- route:
    from:
      uri: "kamelet:timer-source"
      parameters:
        period: 10000
        message: 'test'
      steps:
        - to:
            uri: "kamelet:log-sink"

You can now run it directly through the following command

camel run route.yaml

Camel K Environment Usage

This section describes how you can use the wttrin-source.

Knative source

You can use the wttrin-source Kamelet as a Knative source by binding it to a Knative object.

wttrin-source-binding.yaml
apiVersion: camel.apache.org/v1
kind: KameletBinding
metadata:
  name: wttrin-source-binding
spec:
  source:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1
      name: wttrin-source
  sink:
    ref:
      kind: Channel
      apiVersion: messaging.knative.dev/v1
      name: mychannel

Prerequisite

You have Camel K installed on the cluster.

Procedure for using the cluster CLI

  1. Save the wttrin-source-binding.yaml file to your local drive, and then edit it as needed for your configuration.

  2. Run the source by using the following command:

    kubectl apply -f wttrin-source-binding.yaml

Procedure for using the Kamel CLI

Configure and run the source by using the following command:

kamel bind channel:mychannel  wttrin-source

This command creates the KameletBinding in the current namespace on the cluster.

Kafka source

You can use the wttrin-source Kamelet as a Kafka source by binding it to a Kafka topic.

wttrin-source-binding.yaml
apiVersion: camel.apache.org/v1
kind: KameletBinding
metadata:
  name: wttrin-source-binding
spec:
  source:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1
      name: wttrin-source
  sink:
    ref:
      kind: KafkaTopic
      apiVersion: kafka.strimzi.io/v1beta1
      name: my-topic

Prerequisites

  • You’ve installed Strimzi.

  • You’ve created a topic named my-topic in the current namespace.

  • You have Camel K installed on the cluster.

Procedure for using the cluster CLI

  1. Save the wttrin-source-binding.yaml file to your local drive, and then edit it as needed for your configuration.

  2. Run the source by using the following command:

    kubectl apply -f wttrin-source-binding.yaml

Procedure for using the Kamel CLI

Configure and run the source by using the following command:

kamel bind kafka.strimzi.io/v1beta1:KafkaTopic:my-topic  wttrin-source

This command creates the KameletBinding in the current namespace on the cluster.