I see.. Lookup does work now! Reading CiA I had assumed that the lookup for the (only) bean method happens automatically and would return a CloudBlob instance. Not sure if this my general misunderstanding or is special to using beans in URI.
Thanks Peter -----Original Message----- From: Andrea Cosentino <ancosen1...@yahoo.com.INVALID> Sent: Friday, April 19, 2019 2:24 PM To: users@camel.apache.org Subject: Re: azure-blob with JavaDSL: can't set URI options with bean or any other method ClientBean is the type of element you're trying to set in the registry. But you need to pass a CludBlockBlob. So you may need to do something like myregistry.put("clientreg", new ClientBean().client()); and then use #clientreg in your route. the azureBlobClient parameter expects a CloudBlob instance and you're trying to set a ClientBean instance. The behavior is totally correct. -- Andrea Cosentino ---------------------------------- Apache Camel PMC Chair Apache Karaf Committer Apache Servicemix PMC Member Email: ancosen1...@yahoo.com Twitter: @oscerd2 Github: oscerd On Friday, April 19, 2019, 10:56:09 AM GMT+2, Marx, Peter <peter.m...@knorr-bremse.com> wrote: Hi, I want to add a route for the camel-azure component 2.23.0 in pure JavaDSL with no Spring. Documentation https://github.com/apache/camel/blob/master/components/camel-azure/src/main/docs/azure-blob-component.adoc only recommends to set the credentials and client options with a bean, but I can't get that to work. How to set the options directly in the URI is not described. Without bean I get an exception like this: [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project testjava: An exception occured while executing the Java class. Failed to create route route1: Route(route1)[[From[azure-blob:/shared1/mxtest/blabla?azureB... because of Failed to resolve endpoint: azure-blob:///shared1/mxtest/blabla?azureBlobClient=client due to: Could not find a suitable setter for property: azureBlobClient as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: com.microsoft.azure.storage.blob.CloudBlob with value client With bean it is the same error "no type converter...with value #clientreg" - I assume the bean lookup does not work - would be my 2. question how to fix that.. The azureBlobClient option must be of type CloudBlockBlob, credentials of type StorageCredentials. How can I set the required credentials or client options in the URI ? Peter package testjava; import org.apache.camel.*; import org.apache.camel.impl.SimpleRegistry; import org.apache.camel.language.Bean; import org.apache.camel.main.Main; import org.apache.camel.CamelContext; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.builder.RouteBuilder; import com.microsoft.azure.storage.*; import com.microsoft.azure.storage.blob.*; public class MainApp { public static class ClientBean { public CloudBlockBlob client() { try { StorageCredentials creds = new StorageCredentialsAccountAndKey("shared1", "here gooes my key jG/zyK...."); StorageUri storageURI = new StorageUri(new java.net.URI("https://shared1.blob.core.windows.net/mxtest")); CloudBlockBlob client = new CloudBlockBlob(storageURI, creds); return client; } catch(Exception e) { return null; } } } public static void main(String... args) throws Exception { SimpleRegistry myregistry = new SimpleRegistry(); CamelContext mycontext = new DefaultCamelContext(myregistry); myregistry.put("clientreg", new ClientBean()); // as bean does not work, I try to set the stuff directly: StorageCredentials creds = new StorageCredentialsAccountAndKey("shared1", "here goes my key"); StorageUri storageURI = new StorageUri(new java.net.URI("https://shared1.blob.core.windows.net/mxtest")); CloudBlockBlob client = new CloudBlockBlob(storageURI, creds); mycontext.addRoutes (new RouteBuilder() { @Override public void configure() { //bean does not work: from("azure-blob:/shared1/mxtest/blabla?azureBlobClient=#clientreg") from("azure-blob:/shared1/mxtest/blabla?azureBlobClient=client") .to("file:c:\\mx\\source"); } } ); mycontext.start(); } } Knorr-Bremse Systeme für Schienenfahrzeuge GmbH Sitz: München Geschäftsführer: Dr. Jürgen Wilder (Vorsitzender), Mark Cleobury, Dr. Nicolas Lange, Dr. Peter Radina, Harald Schneider Vorsitzender des Aufsichtsrats: Klaus Deller Registergericht München, HR B 91 181 This transmission is intended solely for the addressee and contains confidential information. If you are not the intended recipient, please immediately inform the sender and delete the message and any attachments from your system. Furthermore, please do not copy the message or disclose the contents to anyone unless agreed otherwise. To the extent permitted by law we shall in no way be liable for any damages, whatever their nature, arising out of transmission failures, viruses, external influence, delays and the like. Knorr-Bremse Systeme für Schienenfahrzeuge GmbH Sitz: München Geschäftsführer: Dr. Jürgen Wilder (Vorsitzender), Mark Cleobury, Dr. Nicolas Lange, Dr. Peter Radina, Harald Schneider Vorsitzender des Aufsichtsrats: Klaus Deller Registergericht München, HR B 91 181 This transmission is intended solely for the addressee and contains confidential information. If you are not the intended recipient, please immediately inform the sender and delete the message and any attachments from your system. Furthermore, please do not copy the message or disclose the contents to anyone unless agreed otherwise. To the extent permitted by law we shall in no way be liable for any damages, whatever their nature, arising out of transmission failures, viruses, external influence, delays and the like.