Created
May 25, 2023 14:30
-
-
Save davsclaus/acce5925c4abce08aff5d41d7747ae44 to your computer and use it in GitHub Desktop.
camel run azure.yaml MyCredential.java camel-kafka-3.20.6-fix.jar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# camel-k: dependency=mvn:com.azure:azure-identity:1.9.0 | |
# camel-k: dependency=mvn:com.microsoft.azure:azure-schemaregistry-kafka-avro:1.1.1 | |
- beans: | |
- name: defaultAzureCredential | |
type: "#class:com.foo.acme.MyCredential" | |
properties: | |
username: "scott" | |
- route: | |
id: "kafka-to-mq" | |
from: | |
uri: "kafka:cheese" | |
parameters: | |
brokers: "localhost:1234" | |
consumerRequestTimeoutMs: "1234" | |
valueDeserializer: 'com.microsoft.azure.schemaregistry.kafka.avro.KafkaAvroDeserializer' | |
additionalProperties.schema.registry.url: 'https://mykafka.servicebus.windows.net' | |
additionalProperties.schema.registry.credential: '#bean:defaultAzureCredential' | |
steps: | |
- to: "log:foo" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.foo.acme; | |
import com.azure.core.credential.AccessToken; | |
import com.azure.core.credential.TokenCredential; | |
import com.azure.core.credential.TokenRequestContext; | |
import reactor.core.publisher.Mono; | |
public class MyCredential implements TokenCredential { | |
private String username; | |
public String getUsername() { | |
return username; | |
} | |
public void setUsername(String username) { | |
this.username = username; | |
} | |
@Override | |
public Mono<AccessToken> getToken(TokenRequestContext tokenRequestContext) { | |
return null; | |
} | |
@Override | |
public AccessToken getTokenSync(TokenRequestContext request) { | |
return TokenCredential.super.getTokenSync(request); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment