4 Replies Latest reply on Mar 4, 2014 3:27 PM by John DeStefano

    DeltaSpike configuration

    John DeStefano Apprentice



      Just wondering if its possible to use the deltaspike configuration mechanism within SwitchYard. For example, when I try to inject a parameter from the apache-deltaspike.properties file which is located in the META-INF directory of the switchyard deployment I get the following exception:




      private String enforceEncryption;


      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [String] with qualifiers [@ConfigProperty] at injection point [[field] @ConfigProperty @Inject private com.example.switchyard.switchyard_hl7.netty.handlers.NettySslHandler.enforceEncryption]


      I've used this same approach in non-switchyard applications without any problem.



        • 1. Re: DeltaSpike configuration
          Tomohisa igarashi Master

          Hi John,

          How about using SwitchYard Implementation Properties instead of deltaspike one? https://docs.jboss.org/author/display/SWITCHYARD/Bean

          Thanks, Tomo

          • 2. Re: DeltaSpike configuration
            John DeStefano Apprentice



            Thanks for the reply. I tried that but it didn't seem to work. Is the @Properties only available in bean classes annotated with @Service? I'm using the netty gateway to receive HL7 messages. I have a serverPipelineFactory parameter on the netty uri with an @Named bean that gets injected fine. Within that bean I'm creating a netty ChannelPipline. One of the classes used in the pipeline (the ssl handler) has a number of parameters (keystore file name, truststore file name, etc...) that I'd like to pull out of a configuration file. I thought the DeltaSpike approach (apache-deltaspike.properties in the META-INF directory) would work since it looks like deltaspike is included with SwitchYard. However, I only see the api jar and not the implementation jar?


            Any guidance would be appreciated. Right now I am using a config file and have written some logic into a producer class to pull values from it with a custom annotation. I'd prefer to use the DeltaSpike or Switchyard approach if either would work.



            • 3. Re: DeltaSpike configuration
              Keith Babo Master

              SwitchYard property support comes in two flavors:

              1. Any value in switchyard.xml can be replaced using property substitution syntax, e.g. ${myproperty:defaultvalue}.
              2. Properties can be injected into a service implementation in a domain-specific way.  For example, a CDI bean service can inject a property with @Property or a Camel service implementation has access to properties via Camel properties support.


              An important limitation to the above w/r/t your use case is the ability to inject property values inside CDI beans that are not service implementations.  I think this would be very useful for a number of reasons.  It looks like DeltaSpike introduced this feature in 0.2-incubating.  We are using 0.3-incubating, so there must be some additional plumbing we need to hook into to get this working.  If this is a feature you'd like to see, please file a JIRA.




              • 4. Re: DeltaSpike configuration
                John DeStefano Apprentice

                Thanks Keith,


                I'll do that.