You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by jbx <jo...@gmail.com> on 2008/04/03 17:36:54 UTC

HelloWorld BC

Hi all,

First of all I am a newbie, so please ignore my ignorance if my question is
obvious.

I have tried to follow the HelloWorld-BC tutorial but it is quite
incomplete, so I hope to close the gaps here. I tried to look around and
lots of people seemed to have problems too but there are no clear answers to
my questions.

1. Is the Service Unit needed? If yes can I follow some other tutorial to
get it done? I tried to follow the steps from other tutorials, but not sure
if I omitted something. In the Hello-World-BC tutorial there is just this:

== 1. Creating a Hello World BC Service Unit 
This is a work in progress 

2. What are the steps to deploy the BC into the actual ServiceMix? Same
problem with the documentation:

== Deploying the Component 
Now that the SA is built, we're ready to deploy it to the JBI container. 

This is a work in progress. I will finish this up very soon

I tried to reason things out and got to a point where I finally got
ServiceMix to load my hello-world-sa (created the missing MyBootstrap.java
etc.) However I must have missed something.

I modified the MySpringComponentTest to use the RemoteServiceMixClient
instead to access the ServiceMix JVM:

RemoteServiceMixClient rc = new 
RemoteServiceMixClient("tcp://localhost:61616");

 but I just got this error:

4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  - ServiceName
({urn:test}service) specified for routing, but can't find it registered


I suspect that this is something related to endpoints and the way the BC was
deployed, but I have no idea what to do next.

In the end I just want to learn how to develop my own BC for a specific
protocol and have it accessible on the [ServiceMix] ESB from other clients
remotely.

Thanks.






-- 
View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16467761.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: HelloWorld BC

Posted by kai0411 <jo...@softechnics.com>.

Do you mean put exchange.getMessage("out") in method public void
process(MessageExchange exchange)? I thought this method was used to process
normalizedMessage back from bus, not to create normalizedMessage to bus, am
I wrong?

Another issue, jbi.registerComponent() does not exist.


gnodet wrote:
> 
> Retrieving the out message can be done using the JBI apis:
>    exchange.getMessage("out")
> 
> The answer I gave will fix number 2 I think, because you should not call
> endpoint.start() directly, so the NPE should not occur if you do things as
> I
> indicated.
> 
> On Fri, Apr 4, 2008 at 3:39 PM, kai0411 <jo...@softechnics.com> wrote:
> 
>>
>> Thanks for the response. I guess that your post is for my question 3 (how
>> to
>> test my consumer BC in MySpringComponentTest.java). Any suggestion for
>> question 1 and 2?
>>
>>
>> gnodet wrote:
>> >
>> > If you go through ServiceMix code and look at the examples, you'll see
>> > more
>> > examples on how to programmatically create endpoints and start those.
>>  You
>> > need the component, so the way to do that is roughtly:
>> >
>> > JBIContainer jbi = new JBIContainer();
>> > jbi.init();
>> > MyComponent cmp = new MyComponent();
>> > MyEndpoint ep = new MyEndpoint();
>> > cmp.setEndpoints(new MyEndpoint[] { ep });
>> > jbi.registerComponent(cmp, "myComponent");
>> > jbi.start();
>> >
>> >
>> >
>> > On Thu, Apr 3, 2008 at 7:08 PM, kai0411 <jo...@softechnics.com>
>> wrote:
>> >
>> >>
>> >>
>> >> I'm following the 'Hello World - BC' tutorial from
>> >> http://servicemix.apache.org/hello-world-bc.html.
>> >> Everything works for a provider BC created by this tutorial.
>> >> But I have problems when try to create a consumer BC.
>> >>
>> >> Problem 1. In provider BC, a method processInOut(MessageExchange
>> >> exchange,
>> >> NormalizedMessage in, NormalizedMessage out) is called, the
>> >> NormalizedMessage 'out' is passed as parameter.
>> >> How do I get NormalizedMessage 'out' in my consumer BC?
>> >>
>> >> Problem 2. In MyconsumerEndpoint.java, super.start() is called in
>> start()
>> >> method.
>> >> I added following code in MySpringComponentTest.java:
>> >>        MyConsumerEndpoint endP = new MyConsumerEndpoint();
>> >>        endP.start();
>> >>
>> >> But got error when I test in JUnit:
>> >> java.lang.NullPointerException
>> >> at
>> >>
>> >>
>> org.apache.servicemix.common.endpoints.ConsumerEndpoint.start(ConsumerEndpoint.java:57)
>> >> [note: line 57 calls ServiceMixComponent component =
>> >> getServiceUnit().getComponent(); in ConsumerEndpoint.start()]
>> >> at
>> >>
>> >>
>> org.apache.servicemix.BCbase.MySpringComponentTest.startRdexServer(MySpringComponentTest.java:77)
>> >> [note: line 47 call super.start(); in MyConsumerEndpoint.start()]
>> >> at
>> >>
>> >>
>> org.apache.servicemix.BCbase.MySpringComponentTest.test(MySpringComponentTest.java:45)
>> >>
>> >> Does anyone have same problem?
>> >>
>> >>
>> >> Problem 3. What changes and configurations I need to make (for
>> instance
>> >> in
>> >> MySpringComponentTest.java) to test my consumer BC?
>> >>
>> >> Appreciate any suggestions.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/HelloWorld-BC-tp16467761p16467828.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Blog: http://gnodet.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/HelloWorld-BC-tp16467761p16491534.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 
kai
-- 
View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16537498.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: HelloWorld BC

Posted by Guillaume Nodet <gn...@gmail.com>.
Retrieving the out message can be done using the JBI apis:
   exchange.getMessage("out")

The answer I gave will fix number 2 I think, because you should not call
endpoint.start() directly, so the NPE should not occur if you do things as I
indicated.

On Fri, Apr 4, 2008 at 3:39 PM, kai0411 <jo...@softechnics.com> wrote:

>
> Thanks for the response. I guess that your post is for my question 3 (how
> to
> test my consumer BC in MySpringComponentTest.java). Any suggestion for
> question 1 and 2?
>
>
> gnodet wrote:
> >
> > If you go through ServiceMix code and look at the examples, you'll see
> > more
> > examples on how to programmatically create endpoints and start those.
>  You
> > need the component, so the way to do that is roughtly:
> >
> > JBIContainer jbi = new JBIContainer();
> > jbi.init();
> > MyComponent cmp = new MyComponent();
> > MyEndpoint ep = new MyEndpoint();
> > cmp.setEndpoints(new MyEndpoint[] { ep });
> > jbi.registerComponent(cmp, "myComponent");
> > jbi.start();
> >
> >
> >
> > On Thu, Apr 3, 2008 at 7:08 PM, kai0411 <jo...@softechnics.com>
> wrote:
> >
> >>
> >>
> >> I'm following the 'Hello World - BC' tutorial from
> >> http://servicemix.apache.org/hello-world-bc.html.
> >> Everything works for a provider BC created by this tutorial.
> >> But I have problems when try to create a consumer BC.
> >>
> >> Problem 1. In provider BC, a method processInOut(MessageExchange
> >> exchange,
> >> NormalizedMessage in, NormalizedMessage out) is called, the
> >> NormalizedMessage 'out' is passed as parameter.
> >> How do I get NormalizedMessage 'out' in my consumer BC?
> >>
> >> Problem 2. In MyconsumerEndpoint.java, super.start() is called in
> start()
> >> method.
> >> I added following code in MySpringComponentTest.java:
> >>        MyConsumerEndpoint endP = new MyConsumerEndpoint();
> >>        endP.start();
> >>
> >> But got error when I test in JUnit:
> >> java.lang.NullPointerException
> >> at
> >>
> >>
> org.apache.servicemix.common.endpoints.ConsumerEndpoint.start(ConsumerEndpoint.java:57)
> >> [note: line 57 calls ServiceMixComponent component =
> >> getServiceUnit().getComponent(); in ConsumerEndpoint.start()]
> >> at
> >>
> >>
> org.apache.servicemix.BCbase.MySpringComponentTest.startRdexServer(MySpringComponentTest.java:77)
> >> [note: line 47 call super.start(); in MyConsumerEndpoint.start()]
> >> at
> >>
> >>
> org.apache.servicemix.BCbase.MySpringComponentTest.test(MySpringComponentTest.java:45)
> >>
> >> Does anyone have same problem?
> >>
> >>
> >> Problem 3. What changes and configurations I need to make (for instance
> >> in
> >> MySpringComponentTest.java) to test my consumer BC?
> >>
> >> Appreciate any suggestions.
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/HelloWorld-BC-tp16467761p16467828.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/HelloWorld-BC-tp16467761p16491534.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: HelloWorld BC

Posted by kai0411 <jo...@softechnics.com>.
Thanks for the response. I guess that your post is for my question 3 (how to
test my consumer BC in MySpringComponentTest.java). Any suggestion for
question 1 and 2?


gnodet wrote:
> 
> If you go through ServiceMix code and look at the examples, you'll see
> more
> examples on how to programmatically create endpoints and start those.  You
> need the component, so the way to do that is roughtly:
> 
> JBIContainer jbi = new JBIContainer();
> jbi.init();
> MyComponent cmp = new MyComponent();
> MyEndpoint ep = new MyEndpoint();
> cmp.setEndpoints(new MyEndpoint[] { ep });
> jbi.registerComponent(cmp, "myComponent");
> jbi.start();
> 
> 
> 
> On Thu, Apr 3, 2008 at 7:08 PM, kai0411 <jo...@softechnics.com> wrote:
> 
>>
>>
>> I'm following the 'Hello World - BC' tutorial from
>> http://servicemix.apache.org/hello-world-bc.html.
>> Everything works for a provider BC created by this tutorial.
>> But I have problems when try to create a consumer BC.
>>
>> Problem 1. In provider BC, a method processInOut(MessageExchange
>> exchange,
>> NormalizedMessage in, NormalizedMessage out) is called, the
>> NormalizedMessage 'out' is passed as parameter.
>> How do I get NormalizedMessage 'out' in my consumer BC?
>>
>> Problem 2. In MyconsumerEndpoint.java, super.start() is called in start()
>> method.
>> I added following code in MySpringComponentTest.java:
>>        MyConsumerEndpoint endP = new MyConsumerEndpoint();
>>        endP.start();
>>
>> But got error when I test in JUnit:
>> java.lang.NullPointerException
>> at
>>
>> org.apache.servicemix.common.endpoints.ConsumerEndpoint.start(ConsumerEndpoint.java:57)
>> [note: line 57 calls ServiceMixComponent component =
>> getServiceUnit().getComponent(); in ConsumerEndpoint.start()]
>> at
>>
>> org.apache.servicemix.BCbase.MySpringComponentTest.startRdexServer(MySpringComponentTest.java:77)
>> [note: line 47 call super.start(); in MyConsumerEndpoint.start()]
>> at
>>
>> org.apache.servicemix.BCbase.MySpringComponentTest.test(MySpringComponentTest.java:45)
>>
>> Does anyone have same problem?
>>
>>
>> Problem 3. What changes and configurations I need to make (for instance
>> in
>> MySpringComponentTest.java) to test my consumer BC?
>>
>> Appreciate any suggestions.
>>
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/HelloWorld-BC-tp16467761p16467828.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16491534.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: HelloWorld BC

Posted by Guillaume Nodet <gn...@gmail.com>.
If you go through ServiceMix code and look at the examples, you'll see more
examples on how to programmatically create endpoints and start those.  You
need the component, so the way to do that is roughtly:

JBIContainer jbi = new JBIContainer();
jbi.init();
MyComponent cmp = new MyComponent();
MyEndpoint ep = new MyEndpoint();
cmp.setEndpoints(new MyEndpoint[] { ep });
jbi.registerComponent(cmp, "myComponent");
jbi.start();



On Thu, Apr 3, 2008 at 7:08 PM, kai0411 <jo...@softechnics.com> wrote:

>
>
> I'm following the 'Hello World - BC' tutorial from
> http://servicemix.apache.org/hello-world-bc.html.
> Everything works for a provider BC created by this tutorial.
> But I have problems when try to create a consumer BC.
>
> Problem 1. In provider BC, a method processInOut(MessageExchange exchange,
> NormalizedMessage in, NormalizedMessage out) is called, the
> NormalizedMessage 'out' is passed as parameter.
> How do I get NormalizedMessage 'out' in my consumer BC?
>
> Problem 2. In MyconsumerEndpoint.java, super.start() is called in start()
> method.
> I added following code in MySpringComponentTest.java:
>        MyConsumerEndpoint endP = new MyConsumerEndpoint();
>        endP.start();
>
> But got error when I test in JUnit:
> java.lang.NullPointerException
> at
>
> org.apache.servicemix.common.endpoints.ConsumerEndpoint.start(ConsumerEndpoint.java:57)
> [note: line 57 calls ServiceMixComponent component =
> getServiceUnit().getComponent(); in ConsumerEndpoint.start()]
> at
>
> org.apache.servicemix.BCbase.MySpringComponentTest.startRdexServer(MySpringComponentTest.java:77)
> [note: line 47 call super.start(); in MyConsumerEndpoint.start()]
> at
>
> org.apache.servicemix.BCbase.MySpringComponentTest.test(MySpringComponentTest.java:45)
>
> Does anyone have same problem?
>
>
> Problem 3. What changes and configurations I need to make (for instance in
> MySpringComponentTest.java) to test my consumer BC?
>
> Appreciate any suggestions.
>
>
>
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/HelloWorld-BC-tp16467761p16467828.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: HelloWorld BC

Posted by kai0411 <jo...@softechnics.com>.

I'm following the 'Hello World - BC' tutorial from
http://servicemix.apache.org/hello-world-bc.html.
Everything works for a provider BC created by this tutorial.
But I have problems when try to create a consumer BC.

Problem 1. In provider BC, a method processInOut(MessageExchange exchange,
NormalizedMessage in, NormalizedMessage out) is called, the
NormalizedMessage 'out' is passed as parameter. 
How do I get NormalizedMessage 'out' in my consumer BC?

Problem 2. In MyconsumerEndpoint.java, super.start() is called in start()
method. 
I added following code in MySpringComponentTest.java:
    	MyConsumerEndpoint endP = new MyConsumerEndpoint();
    	endP.start();

But got error when I test in JUnit:
java.lang.NullPointerException
at
org.apache.servicemix.common.endpoints.ConsumerEndpoint.start(ConsumerEndpoint.java:57) 
[note: line 57 calls ServiceMixComponent component =
getServiceUnit().getComponent(); in ConsumerEndpoint.start()]
at
org.apache.servicemix.BCbase.MySpringComponentTest.startRdexServer(MySpringComponentTest.java:77)
[note: line 47 call super.start(); in MyConsumerEndpoint.start()]
at
org.apache.servicemix.BCbase.MySpringComponentTest.test(MySpringComponentTest.java:45)

Does anyone have same problem?


Problem 3. What changes and configurations I need to make (for instance in
MySpringComponentTest.java) to test my consumer BC?

Appreciate any suggestions.







-- 
View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16467828.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: HelloWorld BC

Posted by lhein <lh...@apache.org>.
Just mail them to: lhein@apache.org

regards,
Lars




lhein wrote:
> 
> Sounds good so far. See answers inline...
> 
> 
> 
> jbx wrote:
>> 
>> Thanks Lars, you answered most of my difficulties. 
>> 
>> Just a couple of last clarifications:
>> 
>> 1. About the xmlns in the <beans> tag, because I didnt explain myself
>> well I think.  We obviously need the <beans> tag itself, it cant be
>> removed. However, I didnt understand the purpose of the second xmlns
>> attribute in the tag below:
>> 
>> <beans
>> xmlns:hwbc="http://org.apache.servicemix.samples.helloworld.bc/1.0" 
>>           xmlns:xyz="http://companyxyz.com">
>> 
>> The first one is referring to the schema generated by the archetype so I
>> understood why it is needed, but the second one is totally invented. My
>> IDE marks it red since it cant resolve it, but on the other hand if I
>> remove it and leave it like this, it complains that the <beans> tag is
>> undeclared:
>> 
>> --> Imagine your application does not only consist of this single SU.
>> Just think about some more SU's which need to communicate with each
>> other. Doing so will need you to define your own service names and
>> operations.
>> The first xmlns is the one which was defined by your BC. It may be a BC
>> made by yourself or by for example the servicemix team. In the later one
>> the namespace will be something like
>> http://org.apache.servicemix/file/1.0. So using this namespace for
>> refering to your own SU's may be a little strange so you define your own
>> company namespace, for example http://www.mycompany.com/ns/jbi. Now you
>> use this namespace when configuring your "service" and "targetService"
>> attributes in the SU's.
>> 
>> 
>> 
>> <beans
>> xmlns:hwbc="http://org.apache.servicemix.samples.helloworld.bc/1.0" > 
>> 
>> Thus it seems that having 2 xmlns declarations for the <beans> tag is
>> necessary, but no idea what is it for since the URL does not refer to
>> anything that works.
>> 
>> 
>> 2. I managed to get the SU and SA deployed in relation to the Hello World
>> BC and I think it now works. (Managed to run RemoteServiceMixClient on it
>> and got the xml message converted). So I think that I managed to get that
>> working. However, when I followed your previous instructions to find the
>> Endpoint from JConsole and browse to org.apache.servicemix > ServiceMix >
>> Endpoint > HelloWorld there was no section named External. There was only
>> Internal. 
>> 
>> --> Now this is really hard to check as I don't have your project. So if
>> you want me to answer this hand me over your ready to deploy BC and SA.
>> 
>> Regards,
>> Lars
>> 
>> 
>> 
>> 
>> Do I have something missing?
>> 
>> 
>> thanks for your patience.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> lhe77 wrote:
>>> 
>>> No problem at all.
>>> See my answers inline...
>>> 
>>> 
>>> jbx schrieb:
>>>> Hi Lars,
>>>>
>>>> Sorry for being so pedantic... but I am really trying to understand the
>>>> details properly.
>>>>
>>>> 1. I dont have anything like this:    
>>>> xmlns:cp="http://www.compart.net/ns/jbi"
>>>> in my xbean.xml (from the example) I have
>>>> xmlns:xyz="http://companyxyz.com"
>>>> This obviously does not exist.  (What is it anyway?)
>>>>
>>>>   
>>> --> of course you don't have this because it's a namespace I use in my
>>> local project.
>>> You should replace the xmlns:xyz with for example xmlns:test. This test
>>> is only the prefix for the tags which may follow now. Replace the
>>> "http://companyxyz.com" with the namespace you have in the pom.xml of
>>> your binding component. See there the namespace tag.
>>> 
>>> 
>>> 
>>>> Can I remove it? When I take it off my IDE complains that the <beans>
>>>> tag is
>>>> not declared. However if I leave it there the IDE complains that
>>>> http://companyxyz.com does not exist (obviously). What should it be?
>>>>
>>>>   
>>> --> the beans tag is of course needed. You can't remove it.
>>>> 2. I discovered that under
>>>> ~\hello-world-smx\hello-world-bc\target\xbean
>>>> there is a file hello-world-bc.xsd. I set my IDE to map
>>>> http://org.apache.servicemix.samples.helloworld.bc/1.0 to that local
>>>> path.
>>>>
>>>> Now the IDE can help me autocomplete a valid xbean.xml.
>>>>
>>>> I followed your previous instructions and I now have something like
>>>> this:
>>>>
>>>> <beans
>>>> xmlns:hwbc="http://org.apache.servicemix.samples.helloworld.bc/1.0" 
>>>>          xmlns:xyz="http://companyxyz.com">
>>>>
>>>>     <hwbc:provider service="" endpoint="" definition="" 
>>>>                  component="" description="" id="" 
>>>>                  interfaceName="" serviceUnit="" xml:lang="">
>>>>
>>>>   </hwbc:provider>
>>>> </beans>
>>>>
>>>>   
>>> --> in the above code you set the prefix "hwbc" to your namespace
>>> "http://org.apache.servicemix.samples.helloworld.bc/1.0". The other
>>> namespace "xyz" is only needed to route a message to another service for
>>> example.
>>> 
>>> The definition you have now is okay for the basics, but you need to
>>> configure it now properly.
>>> 
>>>> How do you know what to put in there? What is the correct service,
>>>> endpoint,
>>>> interfaceName etc. in my case and from where should I get it?
>>>>
>>>>   
>>> --> for the beginning you just name the service, this service unit
>>> provides. Lets say it will be the Hello-Service. So adapt the service
>>> attribute to be "xyz:hello". xyz is now your namespace of choice and the
>>> hello is the service name of this SU.
>>> Now give the endpoint a name: "consumerEndpoint" will do for now.
>>> 
>>> Forget about the other attributes as I never needed them before and
>>> maybe you won't need them for now as well.
>>> 
>>>> 3. How did you get these custom properties through your component in
>>>> the
>>>> provider definition?
>>>>
>>>>                  period="10000"
>>>>                  debugMode="false"
>>>>                  connection="imaps://me@myserver/INBOX?password=pass"
>>>>                  deleteProcessedMessages="false"
>>>>                  processOnlyUnseenMessages="true" />
>>>>
>>>> When I develop my own BC I will obviously need to specify my custom
>>>> properties to set it up (connection settings etc). No idea how to go
>>>> about
>>>> that and the tutorial obviously doesnt include that yet.
>>>>
>>>>   
>>> --> yes, you will need add. properties most of the time.
>>> To have such properties injected to your endpoint's config you have to
>>> do the following...
>>> For example to define a String property:
>>> 
>>> In your endpoint class define a String property...
>>> 
>>> private String logPath;
>>> 
>>> Now add public getter and setter for this property. (most IDE will offer
>>> you this)
>>> 
>>> public String getLogPath() { return this.logPath; }
>>> public void setLogPath(String logPath) { this.logPath = logPath; }
>>> 
>>> Now you can refer from your xbean to this property by doing this:
>>> 
>>> <hwbc:provider service="xyz:hello" endpoint="consumerEndpoint"
>>> logPath="/tmp/">
>>> 
>>> 
>>>> 4. The xsd specifies 3 main tags, the Provider, the Consumer and the
>>>> Component. I suppose that the Consumer is required when the
>>>> MyConsumerEndpoint needs to be used. What about the Component? Do I
>>>> need to
>>>> have it in the xbean.xml? When should it be used and what is it for?
>>>>
>>>>   
>>> To be honest I never had it specified in my xbean files. No real idea
>>> what are they for.
>>> Maybe it's for the component attribute of the endpoint.
>>> 
>>>> Again, apologies for getting stuck so much. At least it might help you
>>>> close
>>>> some gaps for the next version of the Hello World BC tutorial :)
>>>>
>>>>
>>>>   
>>> You are also welcome to add unclear things to the todo list.
>>> 
>>> Regards
>>> Lars
>>> 
>>> 
>>> 
>>>>
>>>>
>>>>
>>>>
>>>> lhe77 wrote:
>>>>   
>>>>> Ok, I will give you a quick example:
>>>>>
>>>>> I developed for example a servicemix-mail binding component.
>>>>> There are 2 kind of endpoint types known by the mail component...
>>>>> The poller will serve as the example:
>>>>>
>>>>> /**
>>>>>  * This is the polling endpoint for the mail component.
>>>>>  *
>>>>>  * @org.apache.xbean.XBean element="poller"
>>>>>  * @author lhein
>>>>>  */
>>>>> public class MailPollerEndpoint extends PollingEndpoint implements
>>>>> MailEndpointType {
>>>>> ....
>>>>> }
>>>>>
>>>>> See the annotation element = "poller". This defines how the endpoint
>>>>> is
>>>>> refered to from inside your SU's xbean.xml.
>>>>> It looks like this:
>>>>>
>>>>> <?xml version="1.0"?>
>>>>> <beans xmlns:mail="http://servicemix.apache.org/mail/1.0"
>>>>>     xmlns:cp="http://www.compart.net/ns/jbi">
>>>>>
>>>>>     <mail:poller service="cp:email" endpoint="emailPollEndpoint"
>>>>>                  targetService="cp:inputRouter"
>>>>>                  targetOperation="cp:process"
>>>>>                  period="10000"
>>>>>                  debugMode="false"
>>>>>                  connection="imaps://me@myserver/INBOX?password=pass"
>>>>>                  deleteProcessedMessages="false"
>>>>>                  processOnlyUnseenMessages="true" />
>>>>>     </mail:poller>
>>>>> </beans>
>>>>>
>>>>> You can see here the
>>>>>     <mail:poller ...
>>>>> where you find the term "poller" again. It means you refer to the
>>>>> MailPollerEndpoint.java class.
>>>>>
>>>>> Where does the <mail: comes from? Look at the pom.xml of the
>>>>> servicemix-mail binding component.
>>>>> You will find a section like this:
>>>>>
>>>>>      <plugin>
>>>>>         <groupId>org.apache.xbean</groupId>
>>>>>         <artifactId>maven-xbean-plugin</artifactId>
>>>>>         <version>${xbean-version}</version>
>>>>>         <executions>
>>>>>           <execution>
>>>>>             <goals>
>>>>>               <goal>mapping</goal>
>>>>>             </goals>
>>>>>             <configuration>
>>>>>              
>>>>> <namespace>http://servicemix.apache.org/mail/1.0</namespace>
>>>>>             </configuration>
>>>>>           </execution>
>>>>>         </executions>
>>>>>       </plugin>
>>>>>
>>>>> Look at the namespace tag. And now look at the xbean.xml above and you
>>>>> will find exactly this namespace defined to be the mail namespace:
>>>>>
>>>>> <beans xmlns:mail="http://servicemix.apache.org/mail/1.0" ...
>>>>>
>>>>> I hope this clarifies the usage a little. If you have further
>>>>> problems,
>>>>> just let us know.
>>>>>
>>>>> Regards
>>>>> Lars
>>>>>
>>>>>
>>>>>
>>>>> jbx schrieb:
>>>>>     
>>>>>> Hi Lars,
>>>>>>
>>>>>> I noticed that the Hello World BC has been updated with a long list
>>>>>> of
>>>>>> TODOs
>>>>>> :)
>>>>>>
>>>>>> I am still struggling to get the xbean.xml configured correctly
>>>>>> (hopefully I
>>>>>> manage today by syndicating some other tutorials and documentation
>>>>>> around
>>>>>> combined with guesswork). I didnt quite understand your
>>>>>> <component:...>
>>>>>> part
>>>>>> and dont know what to add in my xbean yet. I strongly suggest that in
>>>>>> the
>>>>>> tutorial the full working xbean.xml for the SU is put.
>>>>>>
>>>>>> I tried to go to jconsole but (I suppose because of the xbean
>>>>>> problem)
>>>>>> the
>>>>>> HelloWorld endpoint is missing from the list of endpoints under
>>>>>> ServiceMix->Endpoint.
>>>>>>
>>>>>> I also tried to follow the namespace (from the BC) but
>>>>>> http://org.apache.servicemix.samples.helloworld.bc/1.0 does not exist
>>>>>> so
>>>>>> not
>>>>>> even my IDE can auto-complete the tags.
>>>>>>
>>>>>> If you are developing your own BC, how do you create your namespace?
>>>>>> I
>>>>>> dont
>>>>>> think it should be referring to servicemix.samples.helloworld.bc
>>>>>> right?
>>>>>>
>>>>>> Thanks again.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> lhe77 wrote:
>>>>>>   
>>>>>>       
>>>>>>> For your testing error:
>>>>>>>
>>>>>>> Open up a jconsole and connect to your running smx instance.
>>>>>>> Then browse to:
>>>>>>>
>>>>>>> org.apache.servicemix > ServiceMix > Endpoint
>>>>>>>
>>>>>>> There watch out for your helloWorld endpoint.
>>>>>>> Select and expand the item to External and select the
>>>>>>> Attributes node.
>>>>>>>
>>>>>>> Now you can see the serviceName of the endpoint in the list to the
>>>>>>> right.
>>>>>>> This is the uri to send the test messages to I think.
>>>>>>>
>>>>>>> Just to show you also the JMX opportunities of the smx. :)
>>>>>>>
>>>>>>> Regards
>>>>>>> Lars
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Lars Heinemann schrieb:
>>>>>>>     
>>>>>>>         
>>>>>>>> I think now I better understand your point of view.
>>>>>>>> The tutorial really lacks some important information and is also
>>>>>>>> plain wrong in some descriptions. I will update this tutorial asap.
>>>>>>>>
>>>>>>>> For the meanwhile...see my comments inside your mail:
>>>>>>>>
>>>>>>>>
>>>>>>>> jbx schrieb:
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>> Hi Lars, 
>>>>>>>>>
>>>>>>>>> The fact that you have to skip from one tutorial to another trying
>>>>>>>>> to
>>>>>>>>> 'infer' how things should be done (apart from the fact that the
>>>>>>>>> latest
>>>>>>>>> Maven
>>>>>>>>> and its Archetypes do not match the tutorial) simply confuses
>>>>>>>>> newbies
>>>>>>>>> and
>>>>>>>>> creates immense frustration instead of appreciation of the
>>>>>>>>> strength of
>>>>>>>>> the
>>>>>>>>> technology they're trying to learn. 
>>>>>>>>>
>>>>>>>>> How should someone who has just heard about a Service Unit
>>>>>>>>> suddenly
>>>>>>>>> become
>>>>>>>>> an expert and 'know' how to do the SU for a BC if it is not in the
>>>>>>>>> tutorial?
>>>>>>>>>
>>>>>>>>> Just to verify that I am not missing anything out I have done
>>>>>>>>> everything
>>>>>>>>> from scratch again, sorry if its long:
>>>>>>>>>
>>>>>>>>> 1. Created directory hello-world-smx and changed the working
>>>>>>>>> directory
>>>>>>>>> to
>>>>>>>>> it.
>>>>>>>>> 2. Created the servicemix-binding-component archetype from maven
>>>>>>>>>  
>>>>>>>>> Problem: This does not work:
>>>>>>>>>
>>>>>>>>> mvn archetype:create \ 
>>>>>>>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>>>>>>>> -DarchetypeArtifactId=servicemix-binding-component \
>>>>>>>>> -DarchetypeVersion=3.2.1 \
>>>>>>>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>>>>>>>> -DartifactId=hello-world-bc 
>>>>>>>>>
>>>>>>>>> To follow the tutorial in the same way it has to be:
>>>>>>>>> mvn
>>>>>>>>> org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create
>>>>>>>>> \ 
>>>>>>>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>>>>>>>> -DarchetypeArtifactId=servicemix-binding-component \
>>>>>>>>> -DarchetypeVersion=3.2.1 \
>>>>>>>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>>>>>>>> -DartifactId=hello-world-bc 
>>>>>>>>>
>>>>>>>>> It worked for the Getting Started tutorials, so I guess nothing
>>>>>>>>> wrong
>>>>>>>>> with
>>>>>>>>> the above.
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> --> This is a known issue for which even a JIRA exists. The
>>>>>>>> solution
>>>>>>>> you
>>>>>>>> choose was correct.
>>>>>>>>       I will put a hint to the section in the tutorial.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>> 3. mvn install worked.
>>>>>>>>> 4. created the respective IDE project file: mvn idea:idea
>>>>>>>>> 5. modified MyProviderEndpoint.processInOut() accordingly
>>>>>>>>> 6. modified MySpringComponentTest accordingly and performed mvn
>>>>>>>>> install
>>>>>>>>>
>>>>>>>>> When executing MySpringComponentTest it works fine and the
>>>>>>>>> hello-world-bc
>>>>>>>>> converts the message.
>>>>>>>>>
>>>>>>>>> 7. Deploying the BC to ServiceMix. 
>>>>>>>>>
>>>>>>>>> It is not clear if the BC is separate to the SU or the SU is a zip
>>>>>>>>> file
>>>>>>>>> which also contains the BC. In this tutorial it states that mvn
>>>>>>>>> install
>>>>>>>>> has
>>>>>>>>> created an install zip file which can be deployed into servicemix,
>>>>>>>>> but
>>>>>>>>> this
>>>>>>>>> does not complete the deployment of the BC since it needs an SU. 
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> --> imho the BC should be deployed standalone as it should a
>>>>>>>> generic
>>>>>>>> protocol bridge
>>>>>>>> which may be used by several other service units. The zip file of
>>>>>>>> the
>>>>>>>> bc
>>>>>>>> is just dropped to the hotdeploy folder of your smx installation
>>>>>>>> and
>>>>>>>> will be deployed automatically.
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>> From other places on the service-mix site I learnt that an SU is
>>>>>>>>> essentially
>>>>>>>>> like a war file. So one thinks, should I create the SU before
>>>>>>>>> deploying
>>>>>>>>> the
>>>>>>>>> BC into servicemix and deploy 1 zip file (like we do for a webapp)
>>>>>>>>> which
>>>>>>>>> contains the SU which in itself contains the BC. This is quite
>>>>>>>>> confusing.
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> --> no, the BC should be the first step to create. when the bc is
>>>>>>>> deployed you may create a SU and the SA which is in fact only a
>>>>>>>> deploy
>>>>>>>> format for the SU and the SA's zip will be dropped into the
>>>>>>>> hotdeploy
>>>>>>>> folder as well. If the dependency settings of your SU are pointing
>>>>>>>> to
>>>>>>>> your BC then it should even tell you if the BC is not deployed to
>>>>>>>> smx.
>>>>>>>> You can try it if you remove the BC and try to deploy only the SA.
>>>>>>>> smx
>>>>>>>> will tell you in the console that it now awaits the deployment of
>>>>>>>> the
>>>>>>>> hello-world-bc before finishing the deployment of the SA.
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>> I put the BC install file into servicemix /hotdeploy, even though
>>>>>>>>> this
>>>>>>>>> seems
>>>>>>>>> to contradict the above reasoning, but I guess I misunderstood
>>>>>>>>> something
>>>>>>>>> here.
>>>>>>>>>
>>>>>>>>> Problem:
>>>>>>>>>
>>>>>>>>> ERROR - InstallerMBeanImpl             - Class not found:
>>>>>>>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>>>>>>>> java.lang.ClassNotFoundException:
>>>>>>>>> org.apache.servicemix.samples.helloworld.bc.My
>>>>>>>>> Bootstrap in classloader
>>>>>>>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>>>>>>>>         at
>>>>>>>>> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
>>>>>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>>>>>>>>         at
>>>>>>>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.createBootstrap(InstallerMBeanImpl.java:120)
>>>>>>>>>         at
>>>>>>>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.(InstallerMBeanImpl.java:68)
>>>>>>>>>         at
>>>>>>>>> org.apache.servicemix.jbi.framework.InstallationService.initializeInstaller(InstallationService.java:447)
>>>>>>>>>         at
>>>>>>>>> org.apache.servicemix.jbi.framework.InstallationService.doInstallComp
>>>>>>>>> onent(InstallationService.java:429)
>>>>>>>>>         ...
>>>>>>>>>
>>>>>>>>> The only reference to Bootstrap in the tutorial is struck out, as
>>>>>>>>> if
>>>>>>>>> it
>>>>>>>>> is
>>>>>>>>> deprecated, but obviously it is not so. After some reasoning out I
>>>>>>>>> created a
>>>>>>>>> new MyBootstrap class which implements Bootstrap and implements
>>>>>>>>> its
>>>>>>>>> methods.
>>>>>>>>> Ran again mvn install and tried to deploy it again and it worked
>>>>>>>>> (I
>>>>>>>>> think).
>>>>>>>>>
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> --> now as you are telling me this I can remember I had the same
>>>>>>>> problems and I did solve them by adding my own bootstrap class. You
>>>>>>>> did
>>>>>>>> it correctly I think. Maybe gnodet or some other dev can tell you
>>>>>>>> why
>>>>>>>> the archetype for the BC isn't working as it should.
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>> 8. Create the SU.
>>>>>>>>>
>>>>>>>>> The steps to create the SU are missing. Guesswork again, I jumped
>>>>>>>>> around
>>>>>>>>> to
>>>>>>>>> the Hello World SE tutorial instead. I again assume it is the same
>>>>>>>>> for
>>>>>>>>> both
>>>>>>>>> BC and SE. From now on I am practically on my own jumping from
>>>>>>>>> other
>>>>>>>>> tutorials and trying to figure things out the hard way:
>>>>>>>>>
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> --> wow, you are right. I really over-read this fact. It will be
>>>>>>>> added
>>>>>>>> soon.
>>>>>>>> Basically you can use the archetype "servicemix-service-unit" for
>>>>>>>> the
>>>>>>>> SU
>>>>>>>> creation in this case.
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>> I added the following dependency to pom.xml of hello-world-su:
>>>>>>>>>
>>>>>>>>>     
>>>>>>>>>       org.apache.servicemix.samples.helloworld.bc
>>>>>>>>>       hello-world-bc
>>>>>>>>>       1.0-SNAPSHOT
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> --> yes, this is correct if the version of your bc is really
>>>>>>>> 1.0-SNAPSHOT
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>>     
>>>>>>>>>
>>>>>>>>> I added a new xbean.xml file under the resources folder of
>>>>>>>>> hello-world-su:
>>>>>>>>>
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> --> also done correctly. I suppose you used the
>>>>>>>> servicemix-service-unit
>>>>>>>> archetype which doesn't provide an own xbean.xml. But you may copy
>>>>>>>> almost any other xbean...for example the xbean of the file-poller
>>>>>>>> or
>>>>>>>> something similar. Be sure to adapt the xbean file correctly as it
>>>>>>>> uses
>>>>>>>> some annotations of the endpoint classes.
>>>>>>>> In this case the endpoint should be defined:
>>>>>>>>
>>>>>>>> <component:provider ......
>>>>>>>>
>>>>>>>> or
>>>>>>>>
>>>>>>>> <component:consumer ......
>>>>>>>>
>>>>>>>> The component comes from the
>>>>>>>>
>>>>>>>> /**
>>>>>>>>  * @org.apache.xbean.XBean element="component"
>>>>>>>>  */
>>>>>>>> public class MyComponent extends DefaultComponent {
>>>>>>>>
>>>>>>>> --> see the annotation, it will be used.
>>>>>>>>
>>>>>>>>
>>>>>>>> for provider or consumer see the corresponding classes
>>>>>>>> MyConsumerEndpoint and MyProviderEndpoint...it's same there.
>>>>>>>>
>>>>>>>> Also have a look at your BC's pom.xml file. There is a important
>>>>>>>> section
>>>>>>>> to get your namespace for the SU:
>>>>>>>>
>>>>>>>>     ....
>>>>>>>>      <plugin>
>>>>>>>>         <groupId>org.apache.xbean</groupId>
>>>>>>>>         <artifactId>maven-xbean-plugin</artifactId>
>>>>>>>>         <version>${xbean-version}</version>
>>>>>>>>         <executions>
>>>>>>>>           <execution>
>>>>>>>>             <configuration>
>>>>>>>>
>>>>>>>> --> see here the namespace, adapt it if you need to:
>>>>>>>>               <namespace>http://${packageName}/1.0</namespace>
>>>>>>>>
>>>>>>>>             </configuration>
>>>>>>>>             <goals>
>>>>>>>>               <goal>mapping</goal>
>>>>>>>>             </goals>
>>>>>>>>           </execution>
>>>>>>>>         </executions>
>>>>>>>>       </plugin>
>>>>>>>>     ....
>>>>>>>>
>>>>>>>> This namespace will be used in your SU's xbean.xml. Just replace
>>>>>>>> the
>>>>>>>> part after the xmlns:something="..." with your namespace set in the
>>>>>>>> BC's
>>>>>>>> pom.
>>>>>>>>
>>>>>>>> <?xml version="1.0"?>
>>>>>>>> <beans xmlns:something="someuri">
>>>>>>>>       <component:consumer ....
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>>   
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Again even the Hello World SE tutorial has lots of explanations
>>>>>>>>> missing.
>>>>>>>>>
>>>>>>>>> I assume I am done with the SU and try mvn install in its
>>>>>>>>> directory.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 9. Create the SA
>>>>>>>>>
>>>>>>>>> Back to the original Hello World BC tutorial again.
>>>>>>>>> Created the SA through Maven OK. 
>>>>>>>>>
>>>>>>>>> In the tutorial there is the following confusing statement:
>>>>>>>>>
>>>>>>>>> The hello-world-smx directory should now contain the following two
>>>>>>>>> directories: 
>>>>>>>>> $ ls 
>>>>>>>>> hello-world-sa hello-world-bc
>>>>>>>>> If the SU is needed, where is its directory??
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> --> it seems the author saw that the SU creation isn't in the wiki
>>>>>>>> so
>>>>>>>> he
>>>>>>>> skipped it here as well. of course the SU directory is missing
>>>>>>>> here.
>>>>>>>>
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>> The tutorial proceeds with stating that the following needs to be
>>>>>>>>> added
>>>>>>>>> to
>>>>>>>>> the SA pom.xml:
>>>>>>>>>
>>>>>>>>>     
>>>>>>>>>       org.apache.servicemix.samples.helloworld.bc
>>>>>>>>>       hello-world-bc
>>>>>>>>>       1.0-SNAPSHOT
>>>>>>>>>     
>>>>>>>>>
>>>>>>>>> What about the SU??
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> Imho this also makes no sense to me, but maybe there are existing
>>>>>>>> other
>>>>>>>> deployment methods which make it possible.
>>>>>>>> The SA should only have the SU as dependency. The BC is a
>>>>>>>> dependency of
>>>>>>>> the SU.
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>> I proceed blindly with mvn install within the SA directory.
>>>>>>>>>
>>>>>>>>> 10. The top level project
>>>>>>>>>
>>>>>>>>> The tutorial states: Now that we have created the SU and SA
>>>>>>>>> projects a
>>>>>>>>> top
>>>>>>>>> level pom.xml must be manually created and made aware of each
>>>>>>>>> subproject.
>>>>>>>>> pom.xml needs to be edited to include each subproject.
>>>>>>>>>
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> --> there is an open JIRA for having such a super pom archetype.
>>>>>>>> Until
>>>>>>>> it is solved you have to do it manually.
>>>>>>>>
>>>>>>>> The pom should look like this:
>>>>>>>>
>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>> <project xmlns="http://maven.apache.org/POM/4.0.0" 
>>>>>>>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>>>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>>>>>>>> http://maven.apache.org/maven-v4_0_0.xsd">
>>>>>>>>
>>>>>>>>   <modelVersion>4.0.0</modelVersion>
>>>>>>>>
>>>>>>>>   <groupId>org.apache.servicemix.samples.helloworld</groupId>
>>>>>>>>   <artifactId>hello-world-smx</artifactId>
>>>>>>>>   <packaging>pom</packaging>
>>>>>>>>   <version>1.0-SNAPSHOT</version>
>>>>>>>>   <name>Hello World JBI Component</name>
>>>>>>>>
>>>>>>>>   <modules>
>>>>>>>>     <module>hello-world-bc</module>
>>>>>>>>     <module>hello-world-su</module>
>>>>>>>>     <module>hello-world-sa</module>
>>>>>>>>   </modules>
>>>>>>>>
>>>>>>>> </project>
>>>>>>>>
>>>>>>>>
>>>>>>>> Remember this is only a build tool's instruction file. It has
>>>>>>>> nothing
>>>>>>>> to
>>>>>>>> do with smx at this moment. It builds the BC first, then the SU and
>>>>>>>> finally the SA so all the internal dependencies are fine.
>>>>>>>>
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>   4.0.0
>>>>>>>>>
>>>>>>>>>   org.apache.servicemix.samples.helloworld
>>>>>>>>>   hello-world-smx
>>>>>>>>>   pom
>>>>>>>>>   1.0-SNAPSHOT
>>>>>>>>>   Hello World JBI Component
>>>>>>>>>
>>>>>>>>>   
>>>>>>>>>     hello-world-sa
>>>>>>>>>     hello-world-bc
>>>>>>>>>   
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Again, where is the SU?
>>>>>>>>>
>>>>>>>>> The tutorial proceeds further stating that an ls should list the
>>>>>>>>> following
>>>>>>>>> files.
>>>>>>>>>
>>>>>>>>> $ ls 
>>>>>>>>> hello-world-sa hello-world-bc pom.xml
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> no, it better should be:
>>>>>>>>
>>>>>>>> $ ls 
>>>>>>>> hello-world-bc hello-world-sa hello-world-su pom.xml
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>> If the SU is needed, where is it going to be included?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 11. Give Each of the Maven Subprojects a Name
>>>>>>>>> 12. mvn clean install of the root folder 
>>>>>>>>>
>>>>>>>>> 13. Deploying the Component 
>>>>>>>>>
>>>>>>>>> Now that the SA is built, we're ready to deploy it to the JBI
>>>>>>>>> container. 
>>>>>>>>> This is a work in progress. I will finish this up very soon.
>>>>>>>>>
>>>>>>>>> Again missing information.
>>>>>>>>>
>>>>>>>>> I just copied hello-world-sa-1.0-SNAPSHOT.jar.
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> You have to copy the BC and the SA zip files to the hotdeploy
>>>>>>>> folder.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>> At this point I am really looking forward to test the component
>>>>>>>>> out,
>>>>>>>>> so
>>>>>>>>> I
>>>>>>>>> just modified MySpringComponentTest to use the
>>>>>>>>> RemoteServiceMixClient
>>>>>>>>> in
>>>>>>>>> this way:
>>>>>>>>>
>>>>>>>>> RemoteServiceMixClient rc = new 
>>>>>>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>>>>>>
>>>>>>>>> I am shooting blindly at this point since I am not sure what the
>>>>>>>>> QName
>>>>>>>>> URN
>>>>>>>>> should be etc., but assuming that it worked before on the
>>>>>>>>> DefaultServiceMixClient I try it out just the same.
>>>>>>>>>
>>>>>>>>> I get the following error:
>>>>>>>>>
>>>>>>>>> 3253 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>>>>>>> ServiceName
>>>>>>>>> ({urn:test}service) specified for routing, but can't find it
>>>>>>>>> registered
>>>>>>>>> ...
>>>>>>>>> javax.jbi.messaging.MessagingException: Could not find route for
>>>>>>>>> exchange:
>>>>>>>>> InOut[
>>>>>>>>>   id: ID:10.0.0.1-1191902c607-3:0
>>>>>>>>>   status: Active
>>>>>>>>>   role: provider
>>>>>>>>>   service: {urn:test}service
>>>>>>>>>   in: <?xml version="1.0" encoding="UTF-8"?>world
>>>>>>>>> ] for service: {urn:test}service and interface: null
>>>>>>>>> 	at
>>>>>>>>> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
>>>>>>>>> 	at
>>>>>>>>> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
>>>>>>>>> ...
>>>>>>>>>
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> --> the endpoint uri was wrong. See my above comments about the
>>>>>>>> namespace thing.
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>> With all the assumptions and guesswork I had to do, this tutorial
>>>>>>>>> is
>>>>>>>>> definitely NOT straightforward. I would appreciate if someone
>>>>>>>>> could
>>>>>>>>> correct
>>>>>>>>> me where I did a wrong step and tell me what I have to do to
>>>>>>>>> eventually
>>>>>>>>> test
>>>>>>>>> the component with RemoteServiceMixClient.
>>>>>>>>>
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>> --> you are right. it really needs a rework.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> Lars
>>>>>>>>
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>> Thanks.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> lhe77 wrote:
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>>>> Yes, the service unit is needed because it configures the BC.
>>>>>>>>>> I had a look at the Hello World BC wiki page and it looks not
>>>>>>>>>> that
>>>>>>>>>> bad
>>>>>>>>>> as you described it.
>>>>>>>>>>
>>>>>>>>>> Maybe you did not really understand how BC/SE, SU and SA plays
>>>>>>>>>> together.
>>>>>>>>>> BC and SE are engines, which are deployed to the smx. But when
>>>>>>>>>> doing
>>>>>>>>>> it,
>>>>>>>>>> it does not
>>>>>>>>>> mean that you have then a working Hello World example. For doing
>>>>>>>>>> such
>>>>>>>>>> example you have to deploy a Hello World ServiceUnit which
>>>>>>>>>> configures
>>>>>>>>>> an
>>>>>>>>>> endpoint using the BC in a ServiceAssembly.
>>>>>>>>>>
>>>>>>>>>> Please re-read the whole wiki page and don't skip out things. If
>>>>>>>>>> you
>>>>>>>>>> still have problems please describe what you already did and
>>>>>>>>>> what's
>>>>>>>>>> the
>>>>>>>>>> problem exactly.
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>> Lars
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> jbx schrieb:
>>>>>>>>>>     
>>>>>>>>>>       
>>>>>>>>>>           
>>>>>>>>>>               
>>>>>>>>>>> Hi all,
>>>>>>>>>>>
>>>>>>>>>>> First of all I am a newbie, so please ignore my ignorance if my
>>>>>>>>>>> question
>>>>>>>>>>> is
>>>>>>>>>>> obvious.
>>>>>>>>>>>
>>>>>>>>>>> I have tried to follow the HelloWorld-BC tutorial but it is
>>>>>>>>>>> quite
>>>>>>>>>>> incomplete, so I hope to close the gaps here. I tried to look
>>>>>>>>>>> around
>>>>>>>>>>> and
>>>>>>>>>>> lots of people seemed to have problems too but there are no
>>>>>>>>>>> clear
>>>>>>>>>>> answers
>>>>>>>>>>> to
>>>>>>>>>>> my questions.
>>>>>>>>>>>
>>>>>>>>>>> 1. Is the Service Unit needed? If yes can I follow some other
>>>>>>>>>>> tutorial
>>>>>>>>>>> to
>>>>>>>>>>> get it done? I tried to follow the steps from other tutorials,
>>>>>>>>>>> but
>>>>>>>>>>> not
>>>>>>>>>>> sure
>>>>>>>>>>> if I omitted something. In the Hello-World-BC tutorial there is
>>>>>>>>>>> just
>>>>>>>>>>> this:
>>>>>>>>>>>
>>>>>>>>>>> == 1. Creating a Hello World BC Service Unit 
>>>>>>>>>>> This is a work in progress 
>>>>>>>>>>>
>>>>>>>>>>> 2. What are the steps to deploy the BC into the actual
>>>>>>>>>>> ServiceMix?
>>>>>>>>>>> Same
>>>>>>>>>>> problem with the documentation:
>>>>>>>>>>>
>>>>>>>>>>> == Deploying the Component 
>>>>>>>>>>> Now that the SA is built, we're ready to deploy it to the JBI
>>>>>>>>>>> container. 
>>>>>>>>>>>
>>>>>>>>>>> This is a work in progress. I will finish this up very soon
>>>>>>>>>>>
>>>>>>>>>>> I tried to reason things out and got to a point where I finally
>>>>>>>>>>> got
>>>>>>>>>>> ServiceMix to load my hello-world-sa (created the missing
>>>>>>>>>>> MyBootstrap.java
>>>>>>>>>>> etc.) However I must have missed something.
>>>>>>>>>>>
>>>>>>>>>>> I modified the MySpringComponentTest to use the
>>>>>>>>>>> RemoteServiceMixClient
>>>>>>>>>>> instead to access the ServiceMix JVM:
>>>>>>>>>>>
>>>>>>>>>>> RemoteServiceMixClient rc = new 
>>>>>>>>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>>>>>>>>
>>>>>>>>>>>  but I just got this error:
>>>>>>>>>>>
>>>>>>>>>>> 4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>>>>>>>>> ServiceName
>>>>>>>>>>> ({urn:test}service) specified for routing, but can't find it
>>>>>>>>>>> registered
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I suspect that this is something related to endpoints and the
>>>>>>>>>>> way
>>>>>>>>>>> the
>>>>>>>>>>> BC
>>>>>>>>>>> was
>>>>>>>>>>> deployed, but I have no idea what to do next.
>>>>>>>>>>>
>>>>>>>>>>> In the end I just want to learn how to develop my own BC for a
>>>>>>>>>>> specific
>>>>>>>>>>> protocol and have it accessible on the [ServiceMix] ESB from
>>>>>>>>>>> other
>>>>>>>>>>> clients
>>>>>>>>>>> remotely.
>>>>>>>>>>>
>>>>>>>>>>> Thanks.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>   
>>>>>>>>>>>       
>>>>>>>>>>>         
>>>>>>>>>>>             
>>>>>>>>>>>                 
>>>>>>>>>>     
>>>>>>>>>>       
>>>>>>>>>>           
>>>>>>>>>>               
>>>>>>>>>   
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>     
>>>>>>>         
>>>>>>   
>>>>>>       
>>>>>     
>>>>
>>>>   
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16542611.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: HelloWorld BC

Posted by lhein <lh...@apache.org>.
Sounds good so far. See answers inline...



jbx wrote:
> 
> Thanks Lars, you answered most of my difficulties. 
> 
> Just a couple of last clarifications:
> 
> 1. About the xmlns in the <beans> tag, because I didnt explain myself well
> I think.  We obviously need the <beans> tag itself, it cant be removed.
> However, I didnt understand the purpose of the second xmlns attribute in
> the tag below:
> 
> <beans xmlns:hwbc="http://org.apache.servicemix.samples.helloworld.bc/1.0" 
>           xmlns:xyz="http://companyxyz.com">
> 
> The first one is referring to the schema generated by the archetype so I
> understood why it is needed, but the second one is totally invented. My
> IDE marks it red since it cant resolve it, but on the other hand if I
> remove it and leave it like this, it complains that the <beans> tag is
> undeclared:
> 
> --> Imagine your application does not only consist of this single SU. Just
> think about some more SU's which need to communicate with each other.
> Doing so will need you to define your own service names and operations.
> The first xmlns is the one which was defined by your BC. It may be a BC
> made by yourself or by for example the servicemix team. In the later one
> the namespace will be something like
> http://org.apache.servicemix/file/1.0. So using this namespace for
> refering to your own SU's may be a little strange so you define your own
> company namespace, for example http://www.mycompany.com/ns/jbi. Now you
> use this namespace when configuring your "service" and "targetService"
> attributes in the SU's.
> 
> 
> 
> <beans xmlns:hwbc="http://org.apache.servicemix.samples.helloworld.bc/1.0"
> > 
> 
> Thus it seems that having 2 xmlns declarations for the <beans> tag is
> necessary, but no idea what is it for since the URL does not refer to
> anything that works.
> 
> 
> 2. I managed to get the SU and SA deployed in relation to the Hello World
> BC and I think it now works. (Managed to run RemoteServiceMixClient on it
> and got the xml message converted). So I think that I managed to get that
> working. However, when I followed your previous instructions to find the
> Endpoint from JConsole and browse to org.apache.servicemix > ServiceMix >
> Endpoint > HelloWorld there was no section named External. There was only
> Internal. 
> 
> --> Now this is really hard to check as I don't have your project. So if
> you want me to answer this hand me over your ready to deploy BC and SA.
> 
> Regards,
> Lars
> 
> 
> 
> 
> Do I have something missing?
> 
> 
> thanks for your patience.
> 
> 
> 
> 
> 
> 
> 
> lhe77 wrote:
>> 
>> No problem at all.
>> See my answers inline...
>> 
>> 
>> jbx schrieb:
>>> Hi Lars,
>>>
>>> Sorry for being so pedantic... but I am really trying to understand the
>>> details properly.
>>>
>>> 1. I dont have anything like this:    
>>> xmlns:cp="http://www.compart.net/ns/jbi"
>>> in my xbean.xml (from the example) I have
>>> xmlns:xyz="http://companyxyz.com"
>>> This obviously does not exist.  (What is it anyway?)
>>>
>>>   
>> --> of course you don't have this because it's a namespace I use in my
>> local project.
>> You should replace the xmlns:xyz with for example xmlns:test. This test
>> is only the prefix for the tags which may follow now. Replace the
>> "http://companyxyz.com" with the namespace you have in the pom.xml of
>> your binding component. See there the namespace tag.
>> 
>> 
>> 
>>> Can I remove it? When I take it off my IDE complains that the <beans>
>>> tag is
>>> not declared. However if I leave it there the IDE complains that
>>> http://companyxyz.com does not exist (obviously). What should it be?
>>>
>>>   
>> --> the beans tag is of course needed. You can't remove it.
>>> 2. I discovered that under ~\hello-world-smx\hello-world-bc\target\xbean
>>> there is a file hello-world-bc.xsd. I set my IDE to map
>>> http://org.apache.servicemix.samples.helloworld.bc/1.0 to that local
>>> path.
>>>
>>> Now the IDE can help me autocomplete a valid xbean.xml.
>>>
>>> I followed your previous instructions and I now have something like
>>> this:
>>>
>>> <beans
>>> xmlns:hwbc="http://org.apache.servicemix.samples.helloworld.bc/1.0" 
>>>          xmlns:xyz="http://companyxyz.com">
>>>
>>>     <hwbc:provider service="" endpoint="" definition="" 
>>>                  component="" description="" id="" 
>>>                  interfaceName="" serviceUnit="" xml:lang="">
>>>
>>>   </hwbc:provider>
>>> </beans>
>>>
>>>   
>> --> in the above code you set the prefix "hwbc" to your namespace
>> "http://org.apache.servicemix.samples.helloworld.bc/1.0". The other
>> namespace "xyz" is only needed to route a message to another service for
>> example.
>> 
>> The definition you have now is okay for the basics, but you need to
>> configure it now properly.
>> 
>>> How do you know what to put in there? What is the correct service,
>>> endpoint,
>>> interfaceName etc. in my case and from where should I get it?
>>>
>>>   
>> --> for the beginning you just name the service, this service unit
>> provides. Lets say it will be the Hello-Service. So adapt the service
>> attribute to be "xyz:hello". xyz is now your namespace of choice and the
>> hello is the service name of this SU.
>> Now give the endpoint a name: "consumerEndpoint" will do for now.
>> 
>> Forget about the other attributes as I never needed them before and
>> maybe you won't need them for now as well.
>> 
>>> 3. How did you get these custom properties through your component in the
>>> provider definition?
>>>
>>>                  period="10000"
>>>                  debugMode="false"
>>>                  connection="imaps://me@myserver/INBOX?password=pass"
>>>                  deleteProcessedMessages="false"
>>>                  processOnlyUnseenMessages="true" />
>>>
>>> When I develop my own BC I will obviously need to specify my custom
>>> properties to set it up (connection settings etc). No idea how to go
>>> about
>>> that and the tutorial obviously doesnt include that yet.
>>>
>>>   
>> --> yes, you will need add. properties most of the time.
>> To have such properties injected to your endpoint's config you have to
>> do the following...
>> For example to define a String property:
>> 
>> In your endpoint class define a String property...
>> 
>> private String logPath;
>> 
>> Now add public getter and setter for this property. (most IDE will offer
>> you this)
>> 
>> public String getLogPath() { return this.logPath; }
>> public void setLogPath(String logPath) { this.logPath = logPath; }
>> 
>> Now you can refer from your xbean to this property by doing this:
>> 
>> <hwbc:provider service="xyz:hello" endpoint="consumerEndpoint"
>> logPath="/tmp/">
>> 
>> 
>>> 4. The xsd specifies 3 main tags, the Provider, the Consumer and the
>>> Component. I suppose that the Consumer is required when the
>>> MyConsumerEndpoint needs to be used. What about the Component? Do I need
>>> to
>>> have it in the xbean.xml? When should it be used and what is it for?
>>>
>>>   
>> To be honest I never had it specified in my xbean files. No real idea
>> what are they for.
>> Maybe it's for the component attribute of the endpoint.
>> 
>>> Again, apologies for getting stuck so much. At least it might help you
>>> close
>>> some gaps for the next version of the Hello World BC tutorial :)
>>>
>>>
>>>   
>> You are also welcome to add unclear things to the todo list.
>> 
>> Regards
>> Lars
>> 
>> 
>> 
>>>
>>>
>>>
>>>
>>> lhe77 wrote:
>>>   
>>>> Ok, I will give you a quick example:
>>>>
>>>> I developed for example a servicemix-mail binding component.
>>>> There are 2 kind of endpoint types known by the mail component...
>>>> The poller will serve as the example:
>>>>
>>>> /**
>>>>  * This is the polling endpoint for the mail component.
>>>>  *
>>>>  * @org.apache.xbean.XBean element="poller"
>>>>  * @author lhein
>>>>  */
>>>> public class MailPollerEndpoint extends PollingEndpoint implements
>>>> MailEndpointType {
>>>> ....
>>>> }
>>>>
>>>> See the annotation element = "poller". This defines how the endpoint is
>>>> refered to from inside your SU's xbean.xml.
>>>> It looks like this:
>>>>
>>>> <?xml version="1.0"?>
>>>> <beans xmlns:mail="http://servicemix.apache.org/mail/1.0"
>>>>     xmlns:cp="http://www.compart.net/ns/jbi">
>>>>
>>>>     <mail:poller service="cp:email" endpoint="emailPollEndpoint"
>>>>                  targetService="cp:inputRouter"
>>>>                  targetOperation="cp:process"
>>>>                  period="10000"
>>>>                  debugMode="false"
>>>>                  connection="imaps://me@myserver/INBOX?password=pass"
>>>>                  deleteProcessedMessages="false"
>>>>                  processOnlyUnseenMessages="true" />
>>>>     </mail:poller>
>>>> </beans>
>>>>
>>>> You can see here the
>>>>     <mail:poller ...
>>>> where you find the term "poller" again. It means you refer to the
>>>> MailPollerEndpoint.java class.
>>>>
>>>> Where does the <mail: comes from? Look at the pom.xml of the
>>>> servicemix-mail binding component.
>>>> You will find a section like this:
>>>>
>>>>      <plugin>
>>>>         <groupId>org.apache.xbean</groupId>
>>>>         <artifactId>maven-xbean-plugin</artifactId>
>>>>         <version>${xbean-version}</version>
>>>>         <executions>
>>>>           <execution>
>>>>             <goals>
>>>>               <goal>mapping</goal>
>>>>             </goals>
>>>>             <configuration>
>>>>              
>>>> <namespace>http://servicemix.apache.org/mail/1.0</namespace>
>>>>             </configuration>
>>>>           </execution>
>>>>         </executions>
>>>>       </plugin>
>>>>
>>>> Look at the namespace tag. And now look at the xbean.xml above and you
>>>> will find exactly this namespace defined to be the mail namespace:
>>>>
>>>> <beans xmlns:mail="http://servicemix.apache.org/mail/1.0" ...
>>>>
>>>> I hope this clarifies the usage a little. If you have further problems,
>>>> just let us know.
>>>>
>>>> Regards
>>>> Lars
>>>>
>>>>
>>>>
>>>> jbx schrieb:
>>>>     
>>>>> Hi Lars,
>>>>>
>>>>> I noticed that the Hello World BC has been updated with a long list of
>>>>> TODOs
>>>>> :)
>>>>>
>>>>> I am still struggling to get the xbean.xml configured correctly
>>>>> (hopefully I
>>>>> manage today by syndicating some other tutorials and documentation
>>>>> around
>>>>> combined with guesswork). I didnt quite understand your
>>>>> <component:...>
>>>>> part
>>>>> and dont know what to add in my xbean yet. I strongly suggest that in
>>>>> the
>>>>> tutorial the full working xbean.xml for the SU is put.
>>>>>
>>>>> I tried to go to jconsole but (I suppose because of the xbean problem)
>>>>> the
>>>>> HelloWorld endpoint is missing from the list of endpoints under
>>>>> ServiceMix->Endpoint.
>>>>>
>>>>> I also tried to follow the namespace (from the BC) but
>>>>> http://org.apache.servicemix.samples.helloworld.bc/1.0 does not exist
>>>>> so
>>>>> not
>>>>> even my IDE can auto-complete the tags.
>>>>>
>>>>> If you are developing your own BC, how do you create your namespace? I
>>>>> dont
>>>>> think it should be referring to servicemix.samples.helloworld.bc
>>>>> right?
>>>>>
>>>>> Thanks again.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> lhe77 wrote:
>>>>>   
>>>>>       
>>>>>> For your testing error:
>>>>>>
>>>>>> Open up a jconsole and connect to your running smx instance.
>>>>>> Then browse to:
>>>>>>
>>>>>> org.apache.servicemix > ServiceMix > Endpoint
>>>>>>
>>>>>> There watch out for your helloWorld endpoint.
>>>>>> Select and expand the item to External and select the
>>>>>> Attributes node.
>>>>>>
>>>>>> Now you can see the serviceName of the endpoint in the list to the
>>>>>> right.
>>>>>> This is the uri to send the test messages to I think.
>>>>>>
>>>>>> Just to show you also the JMX opportunities of the smx. :)
>>>>>>
>>>>>> Regards
>>>>>> Lars
>>>>>>
>>>>>>
>>>>>>
>>>>>> Lars Heinemann schrieb:
>>>>>>     
>>>>>>         
>>>>>>> I think now I better understand your point of view.
>>>>>>> The tutorial really lacks some important information and is also
>>>>>>> plain wrong in some descriptions. I will update this tutorial asap.
>>>>>>>
>>>>>>> For the meanwhile...see my comments inside your mail:
>>>>>>>
>>>>>>>
>>>>>>> jbx schrieb:
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> Hi Lars, 
>>>>>>>>
>>>>>>>> The fact that you have to skip from one tutorial to another trying
>>>>>>>> to
>>>>>>>> 'infer' how things should be done (apart from the fact that the
>>>>>>>> latest
>>>>>>>> Maven
>>>>>>>> and its Archetypes do not match the tutorial) simply confuses
>>>>>>>> newbies
>>>>>>>> and
>>>>>>>> creates immense frustration instead of appreciation of the strength
>>>>>>>> of
>>>>>>>> the
>>>>>>>> technology they're trying to learn. 
>>>>>>>>
>>>>>>>> How should someone who has just heard about a Service Unit suddenly
>>>>>>>> become
>>>>>>>> an expert and 'know' how to do the SU for a BC if it is not in the
>>>>>>>> tutorial?
>>>>>>>>
>>>>>>>> Just to verify that I am not missing anything out I have done
>>>>>>>> everything
>>>>>>>> from scratch again, sorry if its long:
>>>>>>>>
>>>>>>>> 1. Created directory hello-world-smx and changed the working
>>>>>>>> directory
>>>>>>>> to
>>>>>>>> it.
>>>>>>>> 2. Created the servicemix-binding-component archetype from maven
>>>>>>>>  
>>>>>>>> Problem: This does not work:
>>>>>>>>
>>>>>>>> mvn archetype:create \ 
>>>>>>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>>>>>>> -DarchetypeArtifactId=servicemix-binding-component \
>>>>>>>> -DarchetypeVersion=3.2.1 \
>>>>>>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>>>>>>> -DartifactId=hello-world-bc 
>>>>>>>>
>>>>>>>> To follow the tutorial in the same way it has to be:
>>>>>>>> mvn
>>>>>>>> org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create
>>>>>>>> \ 
>>>>>>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>>>>>>> -DarchetypeArtifactId=servicemix-binding-component \
>>>>>>>> -DarchetypeVersion=3.2.1 \
>>>>>>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>>>>>>> -DartifactId=hello-world-bc 
>>>>>>>>
>>>>>>>> It worked for the Getting Started tutorials, so I guess nothing
>>>>>>>> wrong
>>>>>>>> with
>>>>>>>> the above.
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> --> This is a known issue for which even a JIRA exists. The solution
>>>>>>> you
>>>>>>> choose was correct.
>>>>>>>       I will put a hint to the section in the tutorial.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> 3. mvn install worked.
>>>>>>>> 4. created the respective IDE project file: mvn idea:idea
>>>>>>>> 5. modified MyProviderEndpoint.processInOut() accordingly
>>>>>>>> 6. modified MySpringComponentTest accordingly and performed mvn
>>>>>>>> install
>>>>>>>>
>>>>>>>> When executing MySpringComponentTest it works fine and the
>>>>>>>> hello-world-bc
>>>>>>>> converts the message.
>>>>>>>>
>>>>>>>> 7. Deploying the BC to ServiceMix. 
>>>>>>>>
>>>>>>>> It is not clear if the BC is separate to the SU or the SU is a zip
>>>>>>>> file
>>>>>>>> which also contains the BC. In this tutorial it states that mvn
>>>>>>>> install
>>>>>>>> has
>>>>>>>> created an install zip file which can be deployed into servicemix,
>>>>>>>> but
>>>>>>>> this
>>>>>>>> does not complete the deployment of the BC since it needs an SU. 
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> --> imho the BC should be deployed standalone as it should a generic
>>>>>>> protocol bridge
>>>>>>> which may be used by several other service units. The zip file of
>>>>>>> the
>>>>>>> bc
>>>>>>> is just dropped to the hotdeploy folder of your smx installation and
>>>>>>> will be deployed automatically.
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> From other places on the service-mix site I learnt that an SU is
>>>>>>>> essentially
>>>>>>>> like a war file. So one thinks, should I create the SU before
>>>>>>>> deploying
>>>>>>>> the
>>>>>>>> BC into servicemix and deploy 1 zip file (like we do for a webapp)
>>>>>>>> which
>>>>>>>> contains the SU which in itself contains the BC. This is quite
>>>>>>>> confusing.
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> --> no, the BC should be the first step to create. when the bc is
>>>>>>> deployed you may create a SU and the SA which is in fact only a
>>>>>>> deploy
>>>>>>> format for the SU and the SA's zip will be dropped into the
>>>>>>> hotdeploy
>>>>>>> folder as well. If the dependency settings of your SU are pointing
>>>>>>> to
>>>>>>> your BC then it should even tell you if the BC is not deployed to
>>>>>>> smx.
>>>>>>> You can try it if you remove the BC and try to deploy only the SA.
>>>>>>> smx
>>>>>>> will tell you in the console that it now awaits the deployment of
>>>>>>> the
>>>>>>> hello-world-bc before finishing the deployment of the SA.
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> I put the BC install file into servicemix /hotdeploy, even though
>>>>>>>> this
>>>>>>>> seems
>>>>>>>> to contradict the above reasoning, but I guess I misunderstood
>>>>>>>> something
>>>>>>>> here.
>>>>>>>>
>>>>>>>> Problem:
>>>>>>>>
>>>>>>>> ERROR - InstallerMBeanImpl             - Class not found:
>>>>>>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>>>>>>> java.lang.ClassNotFoundException:
>>>>>>>> org.apache.servicemix.samples.helloworld.bc.My
>>>>>>>> Bootstrap in classloader
>>>>>>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>>>>>>>         at
>>>>>>>> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
>>>>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>>>>>>>         at
>>>>>>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.createBootstrap(InstallerMBeanImpl.java:120)
>>>>>>>>         at
>>>>>>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.(InstallerMBeanImpl.java:68)
>>>>>>>>         at
>>>>>>>> org.apache.servicemix.jbi.framework.InstallationService.initializeInstaller(InstallationService.java:447)
>>>>>>>>         at
>>>>>>>> org.apache.servicemix.jbi.framework.InstallationService.doInstallComp
>>>>>>>> onent(InstallationService.java:429)
>>>>>>>>         ...
>>>>>>>>
>>>>>>>> The only reference to Bootstrap in the tutorial is struck out, as
>>>>>>>> if
>>>>>>>> it
>>>>>>>> is
>>>>>>>> deprecated, but obviously it is not so. After some reasoning out I
>>>>>>>> created a
>>>>>>>> new MyBootstrap class which implements Bootstrap and implements its
>>>>>>>> methods.
>>>>>>>> Ran again mvn install and tried to deploy it again and it worked (I
>>>>>>>> think).
>>>>>>>>
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> --> now as you are telling me this I can remember I had the same
>>>>>>> problems and I did solve them by adding my own bootstrap class. You
>>>>>>> did
>>>>>>> it correctly I think. Maybe gnodet or some other dev can tell you
>>>>>>> why
>>>>>>> the archetype for the BC isn't working as it should.
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> 8. Create the SU.
>>>>>>>>
>>>>>>>> The steps to create the SU are missing. Guesswork again, I jumped
>>>>>>>> around
>>>>>>>> to
>>>>>>>> the Hello World SE tutorial instead. I again assume it is the same
>>>>>>>> for
>>>>>>>> both
>>>>>>>> BC and SE. From now on I am practically on my own jumping from
>>>>>>>> other
>>>>>>>> tutorials and trying to figure things out the hard way:
>>>>>>>>
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> --> wow, you are right. I really over-read this fact. It will be
>>>>>>> added
>>>>>>> soon.
>>>>>>> Basically you can use the archetype "servicemix-service-unit" for
>>>>>>> the
>>>>>>> SU
>>>>>>> creation in this case.
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> I added the following dependency to pom.xml of hello-world-su:
>>>>>>>>
>>>>>>>>     
>>>>>>>>       org.apache.servicemix.samples.helloworld.bc
>>>>>>>>       hello-world-bc
>>>>>>>>       1.0-SNAPSHOT
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> --> yes, this is correct if the version of your bc is really
>>>>>>> 1.0-SNAPSHOT
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>>     
>>>>>>>>
>>>>>>>> I added a new xbean.xml file under the resources folder of
>>>>>>>> hello-world-su:
>>>>>>>>
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> --> also done correctly. I suppose you used the
>>>>>>> servicemix-service-unit
>>>>>>> archetype which doesn't provide an own xbean.xml. But you may copy
>>>>>>> almost any other xbean...for example the xbean of the file-poller or
>>>>>>> something similar. Be sure to adapt the xbean file correctly as it
>>>>>>> uses
>>>>>>> some annotations of the endpoint classes.
>>>>>>> In this case the endpoint should be defined:
>>>>>>>
>>>>>>> <component:provider ......
>>>>>>>
>>>>>>> or
>>>>>>>
>>>>>>> <component:consumer ......
>>>>>>>
>>>>>>> The component comes from the
>>>>>>>
>>>>>>> /**
>>>>>>>  * @org.apache.xbean.XBean element="component"
>>>>>>>  */
>>>>>>> public class MyComponent extends DefaultComponent {
>>>>>>>
>>>>>>> --> see the annotation, it will be used.
>>>>>>>
>>>>>>>
>>>>>>> for provider or consumer see the corresponding classes
>>>>>>> MyConsumerEndpoint and MyProviderEndpoint...it's same there.
>>>>>>>
>>>>>>> Also have a look at your BC's pom.xml file. There is a important
>>>>>>> section
>>>>>>> to get your namespace for the SU:
>>>>>>>
>>>>>>>     ....
>>>>>>>      <plugin>
>>>>>>>         <groupId>org.apache.xbean</groupId>
>>>>>>>         <artifactId>maven-xbean-plugin</artifactId>
>>>>>>>         <version>${xbean-version}</version>
>>>>>>>         <executions>
>>>>>>>           <execution>
>>>>>>>             <configuration>
>>>>>>>
>>>>>>> --> see here the namespace, adapt it if you need to:
>>>>>>>               <namespace>http://${packageName}/1.0</namespace>
>>>>>>>
>>>>>>>             </configuration>
>>>>>>>             <goals>
>>>>>>>               <goal>mapping</goal>
>>>>>>>             </goals>
>>>>>>>           </execution>
>>>>>>>         </executions>
>>>>>>>       </plugin>
>>>>>>>     ....
>>>>>>>
>>>>>>> This namespace will be used in your SU's xbean.xml. Just replace the
>>>>>>> part after the xmlns:something="..." with your namespace set in the
>>>>>>> BC's
>>>>>>> pom.
>>>>>>>
>>>>>>> <?xml version="1.0"?>
>>>>>>> <beans xmlns:something="someuri">
>>>>>>>       <component:consumer ....
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>>   
>>>>>>>>
>>>>>>>>
>>>>>>>> Again even the Hello World SE tutorial has lots of explanations
>>>>>>>> missing.
>>>>>>>>
>>>>>>>> I assume I am done with the SU and try mvn install in its
>>>>>>>> directory.
>>>>>>>>
>>>>>>>>
>>>>>>>> 9. Create the SA
>>>>>>>>
>>>>>>>> Back to the original Hello World BC tutorial again.
>>>>>>>> Created the SA through Maven OK. 
>>>>>>>>
>>>>>>>> In the tutorial there is the following confusing statement:
>>>>>>>>
>>>>>>>> The hello-world-smx directory should now contain the following two
>>>>>>>> directories: 
>>>>>>>> $ ls 
>>>>>>>> hello-world-sa hello-world-bc
>>>>>>>> If the SU is needed, where is its directory??
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> --> it seems the author saw that the SU creation isn't in the wiki
>>>>>>> so
>>>>>>> he
>>>>>>> skipped it here as well. of course the SU directory is missing here.
>>>>>>>
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> The tutorial proceeds with stating that the following needs to be
>>>>>>>> added
>>>>>>>> to
>>>>>>>> the SA pom.xml:
>>>>>>>>
>>>>>>>>     
>>>>>>>>       org.apache.servicemix.samples.helloworld.bc
>>>>>>>>       hello-world-bc
>>>>>>>>       1.0-SNAPSHOT
>>>>>>>>     
>>>>>>>>
>>>>>>>> What about the SU??
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> Imho this also makes no sense to me, but maybe there are existing
>>>>>>> other
>>>>>>> deployment methods which make it possible.
>>>>>>> The SA should only have the SU as dependency. The BC is a dependency
>>>>>>> of
>>>>>>> the SU.
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> I proceed blindly with mvn install within the SA directory.
>>>>>>>>
>>>>>>>> 10. The top level project
>>>>>>>>
>>>>>>>> The tutorial states: Now that we have created the SU and SA
>>>>>>>> projects a
>>>>>>>> top
>>>>>>>> level pom.xml must be manually created and made aware of each
>>>>>>>> subproject.
>>>>>>>> pom.xml needs to be edited to include each subproject.
>>>>>>>>
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> --> there is an open JIRA for having such a super pom archetype.
>>>>>>> Until
>>>>>>> it is solved you have to do it manually.
>>>>>>>
>>>>>>> The pom should look like this:
>>>>>>>
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <project xmlns="http://maven.apache.org/POM/4.0.0" 
>>>>>>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>>>>>>> http://maven.apache.org/maven-v4_0_0.xsd">
>>>>>>>
>>>>>>>   <modelVersion>4.0.0</modelVersion>
>>>>>>>
>>>>>>>   <groupId>org.apache.servicemix.samples.helloworld</groupId>
>>>>>>>   <artifactId>hello-world-smx</artifactId>
>>>>>>>   <packaging>pom</packaging>
>>>>>>>   <version>1.0-SNAPSHOT</version>
>>>>>>>   <name>Hello World JBI Component</name>
>>>>>>>
>>>>>>>   <modules>
>>>>>>>     <module>hello-world-bc</module>
>>>>>>>     <module>hello-world-su</module>
>>>>>>>     <module>hello-world-sa</module>
>>>>>>>   </modules>
>>>>>>>
>>>>>>> </project>
>>>>>>>
>>>>>>>
>>>>>>> Remember this is only a build tool's instruction file. It has
>>>>>>> nothing
>>>>>>> to
>>>>>>> do with smx at this moment. It builds the BC first, then the SU and
>>>>>>> finally the SA so all the internal dependencies are fine.
>>>>>>>
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>
>>>>>>>>
>>>>>>>>   4.0.0
>>>>>>>>
>>>>>>>>   org.apache.servicemix.samples.helloworld
>>>>>>>>   hello-world-smx
>>>>>>>>   pom
>>>>>>>>   1.0-SNAPSHOT
>>>>>>>>   Hello World JBI Component
>>>>>>>>
>>>>>>>>   
>>>>>>>>     hello-world-sa
>>>>>>>>     hello-world-bc
>>>>>>>>   
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Again, where is the SU?
>>>>>>>>
>>>>>>>> The tutorial proceeds further stating that an ls should list the
>>>>>>>> following
>>>>>>>> files.
>>>>>>>>
>>>>>>>> $ ls 
>>>>>>>> hello-world-sa hello-world-bc pom.xml
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> no, it better should be:
>>>>>>>
>>>>>>> $ ls 
>>>>>>> hello-world-bc hello-world-sa hello-world-su pom.xml
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> If the SU is needed, where is it going to be included?
>>>>>>>>
>>>>>>>>
>>>>>>>> 11. Give Each of the Maven Subprojects a Name
>>>>>>>> 12. mvn clean install of the root folder 
>>>>>>>>
>>>>>>>> 13. Deploying the Component 
>>>>>>>>
>>>>>>>> Now that the SA is built, we're ready to deploy it to the JBI
>>>>>>>> container. 
>>>>>>>> This is a work in progress. I will finish this up very soon.
>>>>>>>>
>>>>>>>> Again missing information.
>>>>>>>>
>>>>>>>> I just copied hello-world-sa-1.0-SNAPSHOT.jar.
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> You have to copy the BC and the SA zip files to the hotdeploy
>>>>>>> folder.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> At this point I am really looking forward to test the component
>>>>>>>> out,
>>>>>>>> so
>>>>>>>> I
>>>>>>>> just modified MySpringComponentTest to use the
>>>>>>>> RemoteServiceMixClient
>>>>>>>> in
>>>>>>>> this way:
>>>>>>>>
>>>>>>>> RemoteServiceMixClient rc = new 
>>>>>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>>>>>
>>>>>>>> I am shooting blindly at this point since I am not sure what the
>>>>>>>> QName
>>>>>>>> URN
>>>>>>>> should be etc., but assuming that it worked before on the
>>>>>>>> DefaultServiceMixClient I try it out just the same.
>>>>>>>>
>>>>>>>> I get the following error:
>>>>>>>>
>>>>>>>> 3253 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>>>>>> ServiceName
>>>>>>>> ({urn:test}service) specified for routing, but can't find it
>>>>>>>> registered
>>>>>>>> ...
>>>>>>>> javax.jbi.messaging.MessagingException: Could not find route for
>>>>>>>> exchange:
>>>>>>>> InOut[
>>>>>>>>   id: ID:10.0.0.1-1191902c607-3:0
>>>>>>>>   status: Active
>>>>>>>>   role: provider
>>>>>>>>   service: {urn:test}service
>>>>>>>>   in: <?xml version="1.0" encoding="UTF-8"?>world
>>>>>>>> ] for service: {urn:test}service and interface: null
>>>>>>>> 	at
>>>>>>>> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
>>>>>>>> 	at
>>>>>>>> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
>>>>>>>> ...
>>>>>>>>
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> --> the endpoint uri was wrong. See my above comments about the
>>>>>>> namespace thing.
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> With all the assumptions and guesswork I had to do, this tutorial
>>>>>>>> is
>>>>>>>> definitely NOT straightforward. I would appreciate if someone could
>>>>>>>> correct
>>>>>>>> me where I did a wrong step and tell me what I have to do to
>>>>>>>> eventually
>>>>>>>> test
>>>>>>>> the component with RemoteServiceMixClient.
>>>>>>>>
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>> --> you are right. it really needs a rework.
>>>>>>>
>>>>>>> Regards
>>>>>>> Lars
>>>>>>>
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> lhe77 wrote:
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>>>> Yes, the service unit is needed because it configures the BC.
>>>>>>>>> I had a look at the Hello World BC wiki page and it looks not that
>>>>>>>>> bad
>>>>>>>>> as you described it.
>>>>>>>>>
>>>>>>>>> Maybe you did not really understand how BC/SE, SU and SA plays
>>>>>>>>> together.
>>>>>>>>> BC and SE are engines, which are deployed to the smx. But when
>>>>>>>>> doing
>>>>>>>>> it,
>>>>>>>>> it does not
>>>>>>>>> mean that you have then a working Hello World example. For doing
>>>>>>>>> such
>>>>>>>>> example you have to deploy a Hello World ServiceUnit which
>>>>>>>>> configures
>>>>>>>>> an
>>>>>>>>> endpoint using the BC in a ServiceAssembly.
>>>>>>>>>
>>>>>>>>> Please re-read the whole wiki page and don't skip out things. If
>>>>>>>>> you
>>>>>>>>> still have problems please describe what you already did and
>>>>>>>>> what's
>>>>>>>>> the
>>>>>>>>> problem exactly.
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>> Lars
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> jbx schrieb:
>>>>>>>>>     
>>>>>>>>>       
>>>>>>>>>           
>>>>>>>>>               
>>>>>>>>>> Hi all,
>>>>>>>>>>
>>>>>>>>>> First of all I am a newbie, so please ignore my ignorance if my
>>>>>>>>>> question
>>>>>>>>>> is
>>>>>>>>>> obvious.
>>>>>>>>>>
>>>>>>>>>> I have tried to follow the HelloWorld-BC tutorial but it is quite
>>>>>>>>>> incomplete, so I hope to close the gaps here. I tried to look
>>>>>>>>>> around
>>>>>>>>>> and
>>>>>>>>>> lots of people seemed to have problems too but there are no clear
>>>>>>>>>> answers
>>>>>>>>>> to
>>>>>>>>>> my questions.
>>>>>>>>>>
>>>>>>>>>> 1. Is the Service Unit needed? If yes can I follow some other
>>>>>>>>>> tutorial
>>>>>>>>>> to
>>>>>>>>>> get it done? I tried to follow the steps from other tutorials,
>>>>>>>>>> but
>>>>>>>>>> not
>>>>>>>>>> sure
>>>>>>>>>> if I omitted something. In the Hello-World-BC tutorial there is
>>>>>>>>>> just
>>>>>>>>>> this:
>>>>>>>>>>
>>>>>>>>>> == 1. Creating a Hello World BC Service Unit 
>>>>>>>>>> This is a work in progress 
>>>>>>>>>>
>>>>>>>>>> 2. What are the steps to deploy the BC into the actual
>>>>>>>>>> ServiceMix?
>>>>>>>>>> Same
>>>>>>>>>> problem with the documentation:
>>>>>>>>>>
>>>>>>>>>> == Deploying the Component 
>>>>>>>>>> Now that the SA is built, we're ready to deploy it to the JBI
>>>>>>>>>> container. 
>>>>>>>>>>
>>>>>>>>>> This is a work in progress. I will finish this up very soon
>>>>>>>>>>
>>>>>>>>>> I tried to reason things out and got to a point where I finally
>>>>>>>>>> got
>>>>>>>>>> ServiceMix to load my hello-world-sa (created the missing
>>>>>>>>>> MyBootstrap.java
>>>>>>>>>> etc.) However I must have missed something.
>>>>>>>>>>
>>>>>>>>>> I modified the MySpringComponentTest to use the
>>>>>>>>>> RemoteServiceMixClient
>>>>>>>>>> instead to access the ServiceMix JVM:
>>>>>>>>>>
>>>>>>>>>> RemoteServiceMixClient rc = new 
>>>>>>>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>>>>>>>
>>>>>>>>>>  but I just got this error:
>>>>>>>>>>
>>>>>>>>>> 4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>>>>>>>> ServiceName
>>>>>>>>>> ({urn:test}service) specified for routing, but can't find it
>>>>>>>>>> registered
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I suspect that this is something related to endpoints and the way
>>>>>>>>>> the
>>>>>>>>>> BC
>>>>>>>>>> was
>>>>>>>>>> deployed, but I have no idea what to do next.
>>>>>>>>>>
>>>>>>>>>> In the end I just want to learn how to develop my own BC for a
>>>>>>>>>> specific
>>>>>>>>>> protocol and have it accessible on the [ServiceMix] ESB from
>>>>>>>>>> other
>>>>>>>>>> clients
>>>>>>>>>> remotely.
>>>>>>>>>>
>>>>>>>>>> Thanks.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>   
>>>>>>>>>>       
>>>>>>>>>>         
>>>>>>>>>>             
>>>>>>>>>>                 
>>>>>>>>>     
>>>>>>>>>       
>>>>>>>>>           
>>>>>>>>>               
>>>>>>>>   
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>     
>>>>>>         
>>>>>   
>>>>>       
>>>>     
>>>
>>>   
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16540474.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: HelloWorld BC

Posted by jbx <jo...@gmail.com>.
Thanks Lars, you answered most of my difficulties. 

Just a couple of last clarifications:

1. About the xmlns in the <beans> tag, because I didnt explain myself well I
think.  We obviously need the <beans> tag itself, it cant be removed.
However, I didnt understand the purpose of the second xmlns attribute in the
tag below:

<beans xmlns:hwbc="http://org.apache.servicemix.samples.helloworld.bc/1.0" 
          xmlns:xyz="http://companyxyz.com">

The first one is referring to the schema generated by the archetype so I
understood why it is needed, but the second one is totally invented. My IDE
marks it red since it cant resolve it, but on the other hand if I remove it
and leave it like this, it complains that the <beans> tag is undeclared:

<beans xmlns:hwbc="http://org.apache.servicemix.samples.helloworld.bc/1.0" > 

Thus it seems that having 2 xmlns declarations for the <beans> tag is
necessary, but no idea what is it for since the URL does not refer to
anything that works.


2. I managed to get the SU and SA deployed in relation to the Hello World BC
and I think it now works. (Managed to run RemoteServiceMixClient on it and
got the xml message converted). So I think that I managed to get that
working. However, when I followed your previous instructions to find the
Endpoint from JConsole and browse to org.apache.servicemix > ServiceMix >
Endpoint > HelloWorld there was no section named External. There was only
Internal. 

Do I have something missing?


thanks for your patience.




lhe77 wrote:
> 
> No problem at all.
> See my answers inline...
> 
> 
> jbx schrieb:
>> Hi Lars,
>>
>> Sorry for being so pedantic... but I am really trying to understand the
>> details properly.
>>
>> 1. I dont have anything like this:    
>> xmlns:cp="http://www.compart.net/ns/jbi"
>> in my xbean.xml (from the example) I have
>> xmlns:xyz="http://companyxyz.com"
>> This obviously does not exist.  (What is it anyway?)
>>
>>   
> --> of course you don't have this because it's a namespace I use in my
> local project.
> You should replace the xmlns:xyz with for example xmlns:test. This test
> is only the prefix for the tags which may follow now. Replace the
> "http://companyxyz.com" with the namespace you have in the pom.xml of
> your binding component. See there the namespace tag.
> 
> 
> 
>> Can I remove it? When I take it off my IDE complains that the <beans> tag
>> is
>> not declared. However if I leave it there the IDE complains that
>> http://companyxyz.com does not exist (obviously). What should it be?
>>
>>   
> --> the beans tag is of course needed. You can't remove it.
>> 2. I discovered that under ~\hello-world-smx\hello-world-bc\target\xbean
>> there is a file hello-world-bc.xsd. I set my IDE to map
>> http://org.apache.servicemix.samples.helloworld.bc/1.0 to that local
>> path.
>>
>> Now the IDE can help me autocomplete a valid xbean.xml.
>>
>> I followed your previous instructions and I now have something like this:
>>
>> <beans
>> xmlns:hwbc="http://org.apache.servicemix.samples.helloworld.bc/1.0" 
>>          xmlns:xyz="http://companyxyz.com">
>>
>>     <hwbc:provider service="" endpoint="" definition="" 
>>                  component="" description="" id="" 
>>                  interfaceName="" serviceUnit="" xml:lang="">
>>
>>   </hwbc:provider>
>> </beans>
>>
>>   
> --> in the above code you set the prefix "hwbc" to your namespace
> "http://org.apache.servicemix.samples.helloworld.bc/1.0". The other
> namespace "xyz" is only needed to route a message to another service for
> example.
> 
> The definition you have now is okay for the basics, but you need to
> configure it now properly.
> 
>> How do you know what to put in there? What is the correct service,
>> endpoint,
>> interfaceName etc. in my case and from where should I get it?
>>
>>   
> --> for the beginning you just name the service, this service unit
> provides. Lets say it will be the Hello-Service. So adapt the service
> attribute to be "xyz:hello". xyz is now your namespace of choice and the
> hello is the service name of this SU.
> Now give the endpoint a name: "consumerEndpoint" will do for now.
> 
> Forget about the other attributes as I never needed them before and
> maybe you won't need them for now as well.
> 
>> 3. How did you get these custom properties through your component in the
>> provider definition?
>>
>>                  period="10000"
>>                  debugMode="false"
>>                  connection="imaps://me@myserver/INBOX?password=pass"
>>                  deleteProcessedMessages="false"
>>                  processOnlyUnseenMessages="true" />
>>
>> When I develop my own BC I will obviously need to specify my custom
>> properties to set it up (connection settings etc). No idea how to go
>> about
>> that and the tutorial obviously doesnt include that yet.
>>
>>   
> --> yes, you will need add. properties most of the time.
> To have such properties injected to your endpoint's config you have to
> do the following...
> For example to define a String property:
> 
> In your endpoint class define a String property...
> 
> private String logPath;
> 
> Now add public getter and setter for this property. (most IDE will offer
> you this)
> 
> public String getLogPath() { return this.logPath; }
> public void setLogPath(String logPath) { this.logPath = logPath; }
> 
> Now you can refer from your xbean to this property by doing this:
> 
> <hwbc:provider service="xyz:hello" endpoint="consumerEndpoint"
> logPath="/tmp/">
> 
> 
>> 4. The xsd specifies 3 main tags, the Provider, the Consumer and the
>> Component. I suppose that the Consumer is required when the
>> MyConsumerEndpoint needs to be used. What about the Component? Do I need
>> to
>> have it in the xbean.xml? When should it be used and what is it for?
>>
>>   
> To be honest I never had it specified in my xbean files. No real idea
> what are they for.
> Maybe it's for the component attribute of the endpoint.
> 
>> Again, apologies for getting stuck so much. At least it might help you
>> close
>> some gaps for the next version of the Hello World BC tutorial :)
>>
>>
>>   
> You are also welcome to add unclear things to the todo list.
> 
> Regards
> Lars
> 
> 
> 
>>
>>
>>
>>
>> lhe77 wrote:
>>   
>>> Ok, I will give you a quick example:
>>>
>>> I developed for example a servicemix-mail binding component.
>>> There are 2 kind of endpoint types known by the mail component...
>>> The poller will serve as the example:
>>>
>>> /**
>>>  * This is the polling endpoint for the mail component.
>>>  *
>>>  * @org.apache.xbean.XBean element="poller"
>>>  * @author lhein
>>>  */
>>> public class MailPollerEndpoint extends PollingEndpoint implements
>>> MailEndpointType {
>>> ....
>>> }
>>>
>>> See the annotation element = "poller". This defines how the endpoint is
>>> refered to from inside your SU's xbean.xml.
>>> It looks like this:
>>>
>>> <?xml version="1.0"?>
>>> <beans xmlns:mail="http://servicemix.apache.org/mail/1.0"
>>>     xmlns:cp="http://www.compart.net/ns/jbi">
>>>
>>>     <mail:poller service="cp:email" endpoint="emailPollEndpoint"
>>>                  targetService="cp:inputRouter"
>>>                  targetOperation="cp:process"
>>>                  period="10000"
>>>                  debugMode="false"
>>>                  connection="imaps://me@myserver/INBOX?password=pass"
>>>                  deleteProcessedMessages="false"
>>>                  processOnlyUnseenMessages="true" />
>>>     </mail:poller>
>>> </beans>
>>>
>>> You can see here the
>>>     <mail:poller ...
>>> where you find the term "poller" again. It means you refer to the
>>> MailPollerEndpoint.java class.
>>>
>>> Where does the <mail: comes from? Look at the pom.xml of the
>>> servicemix-mail binding component.
>>> You will find a section like this:
>>>
>>>      <plugin>
>>>         <groupId>org.apache.xbean</groupId>
>>>         <artifactId>maven-xbean-plugin</artifactId>
>>>         <version>${xbean-version}</version>
>>>         <executions>
>>>           <execution>
>>>             <goals>
>>>               <goal>mapping</goal>
>>>             </goals>
>>>             <configuration>
>>>              
>>> <namespace>http://servicemix.apache.org/mail/1.0</namespace>
>>>             </configuration>
>>>           </execution>
>>>         </executions>
>>>       </plugin>
>>>
>>> Look at the namespace tag. And now look at the xbean.xml above and you
>>> will find exactly this namespace defined to be the mail namespace:
>>>
>>> <beans xmlns:mail="http://servicemix.apache.org/mail/1.0" ...
>>>
>>> I hope this clarifies the usage a little. If you have further problems,
>>> just let us know.
>>>
>>> Regards
>>> Lars
>>>
>>>
>>>
>>> jbx schrieb:
>>>     
>>>> Hi Lars,
>>>>
>>>> I noticed that the Hello World BC has been updated with a long list of
>>>> TODOs
>>>> :)
>>>>
>>>> I am still struggling to get the xbean.xml configured correctly
>>>> (hopefully I
>>>> manage today by syndicating some other tutorials and documentation
>>>> around
>>>> combined with guesswork). I didnt quite understand your <component:...>
>>>> part
>>>> and dont know what to add in my xbean yet. I strongly suggest that in
>>>> the
>>>> tutorial the full working xbean.xml for the SU is put.
>>>>
>>>> I tried to go to jconsole but (I suppose because of the xbean problem)
>>>> the
>>>> HelloWorld endpoint is missing from the list of endpoints under
>>>> ServiceMix->Endpoint.
>>>>
>>>> I also tried to follow the namespace (from the BC) but
>>>> http://org.apache.servicemix.samples.helloworld.bc/1.0 does not exist
>>>> so
>>>> not
>>>> even my IDE can auto-complete the tags.
>>>>
>>>> If you are developing your own BC, how do you create your namespace? I
>>>> dont
>>>> think it should be referring to servicemix.samples.helloworld.bc right?
>>>>
>>>> Thanks again.
>>>>
>>>>
>>>>
>>>>
>>>> lhe77 wrote:
>>>>   
>>>>       
>>>>> For your testing error:
>>>>>
>>>>> Open up a jconsole and connect to your running smx instance.
>>>>> Then browse to:
>>>>>
>>>>> org.apache.servicemix > ServiceMix > Endpoint
>>>>>
>>>>> There watch out for your helloWorld endpoint.
>>>>> Select and expand the item to External and select the
>>>>> Attributes node.
>>>>>
>>>>> Now you can see the serviceName of the endpoint in the list to the
>>>>> right.
>>>>> This is the uri to send the test messages to I think.
>>>>>
>>>>> Just to show you also the JMX opportunities of the smx. :)
>>>>>
>>>>> Regards
>>>>> Lars
>>>>>
>>>>>
>>>>>
>>>>> Lars Heinemann schrieb:
>>>>>     
>>>>>         
>>>>>> I think now I better understand your point of view.
>>>>>> The tutorial really lacks some important information and is also
>>>>>> plain wrong in some descriptions. I will update this tutorial asap.
>>>>>>
>>>>>> For the meanwhile...see my comments inside your mail:
>>>>>>
>>>>>>
>>>>>> jbx schrieb:
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> Hi Lars, 
>>>>>>>
>>>>>>> The fact that you have to skip from one tutorial to another trying
>>>>>>> to
>>>>>>> 'infer' how things should be done (apart from the fact that the
>>>>>>> latest
>>>>>>> Maven
>>>>>>> and its Archetypes do not match the tutorial) simply confuses
>>>>>>> newbies
>>>>>>> and
>>>>>>> creates immense frustration instead of appreciation of the strength
>>>>>>> of
>>>>>>> the
>>>>>>> technology they're trying to learn. 
>>>>>>>
>>>>>>> How should someone who has just heard about a Service Unit suddenly
>>>>>>> become
>>>>>>> an expert and 'know' how to do the SU for a BC if it is not in the
>>>>>>> tutorial?
>>>>>>>
>>>>>>> Just to verify that I am not missing anything out I have done
>>>>>>> everything
>>>>>>> from scratch again, sorry if its long:
>>>>>>>
>>>>>>> 1. Created directory hello-world-smx and changed the working
>>>>>>> directory
>>>>>>> to
>>>>>>> it.
>>>>>>> 2. Created the servicemix-binding-component archetype from maven
>>>>>>>  
>>>>>>> Problem: This does not work:
>>>>>>>
>>>>>>> mvn archetype:create \ 
>>>>>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>>>>>> -DarchetypeArtifactId=servicemix-binding-component \
>>>>>>> -DarchetypeVersion=3.2.1 \
>>>>>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>>>>>> -DartifactId=hello-world-bc 
>>>>>>>
>>>>>>> To follow the tutorial in the same way it has to be:
>>>>>>> mvn
>>>>>>> org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create
>>>>>>> \ 
>>>>>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>>>>>> -DarchetypeArtifactId=servicemix-binding-component \
>>>>>>> -DarchetypeVersion=3.2.1 \
>>>>>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>>>>>> -DartifactId=hello-world-bc 
>>>>>>>
>>>>>>> It worked for the Getting Started tutorials, so I guess nothing
>>>>>>> wrong
>>>>>>> with
>>>>>>> the above.
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> --> This is a known issue for which even a JIRA exists. The solution
>>>>>> you
>>>>>> choose was correct.
>>>>>>       I will put a hint to the section in the tutorial.
>>>>>>
>>>>>>
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> 3. mvn install worked.
>>>>>>> 4. created the respective IDE project file: mvn idea:idea
>>>>>>> 5. modified MyProviderEndpoint.processInOut() accordingly
>>>>>>> 6. modified MySpringComponentTest accordingly and performed mvn
>>>>>>> install
>>>>>>>
>>>>>>> When executing MySpringComponentTest it works fine and the
>>>>>>> hello-world-bc
>>>>>>> converts the message.
>>>>>>>
>>>>>>> 7. Deploying the BC to ServiceMix. 
>>>>>>>
>>>>>>> It is not clear if the BC is separate to the SU or the SU is a zip
>>>>>>> file
>>>>>>> which also contains the BC. In this tutorial it states that mvn
>>>>>>> install
>>>>>>> has
>>>>>>> created an install zip file which can be deployed into servicemix,
>>>>>>> but
>>>>>>> this
>>>>>>> does not complete the deployment of the BC since it needs an SU. 
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> --> imho the BC should be deployed standalone as it should a generic
>>>>>> protocol bridge
>>>>>> which may be used by several other service units. The zip file of the
>>>>>> bc
>>>>>> is just dropped to the hotdeploy folder of your smx installation and
>>>>>> will be deployed automatically.
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> From other places on the service-mix site I learnt that an SU is
>>>>>>> essentially
>>>>>>> like a war file. So one thinks, should I create the SU before
>>>>>>> deploying
>>>>>>> the
>>>>>>> BC into servicemix and deploy 1 zip file (like we do for a webapp)
>>>>>>> which
>>>>>>> contains the SU which in itself contains the BC. This is quite
>>>>>>> confusing.
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> --> no, the BC should be the first step to create. when the bc is
>>>>>> deployed you may create a SU and the SA which is in fact only a
>>>>>> deploy
>>>>>> format for the SU and the SA's zip will be dropped into the hotdeploy
>>>>>> folder as well. If the dependency settings of your SU are pointing to
>>>>>> your BC then it should even tell you if the BC is not deployed to
>>>>>> smx.
>>>>>> You can try it if you remove the BC and try to deploy only the SA.
>>>>>> smx
>>>>>> will tell you in the console that it now awaits the deployment of the
>>>>>> hello-world-bc before finishing the deployment of the SA.
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> I put the BC install file into servicemix /hotdeploy, even though
>>>>>>> this
>>>>>>> seems
>>>>>>> to contradict the above reasoning, but I guess I misunderstood
>>>>>>> something
>>>>>>> here.
>>>>>>>
>>>>>>> Problem:
>>>>>>>
>>>>>>> ERROR - InstallerMBeanImpl             - Class not found:
>>>>>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>>>>>> java.lang.ClassNotFoundException:
>>>>>>> org.apache.servicemix.samples.helloworld.bc.My
>>>>>>> Bootstrap in classloader
>>>>>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>>>>>>         at
>>>>>>> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
>>>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>>>>>>         at
>>>>>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.createBootstrap(InstallerMBeanImpl.java:120)
>>>>>>>         at
>>>>>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.(InstallerMBeanImpl.java:68)
>>>>>>>         at
>>>>>>> org.apache.servicemix.jbi.framework.InstallationService.initializeInstaller(InstallationService.java:447)
>>>>>>>         at
>>>>>>> org.apache.servicemix.jbi.framework.InstallationService.doInstallComp
>>>>>>> onent(InstallationService.java:429)
>>>>>>>         ...
>>>>>>>
>>>>>>> The only reference to Bootstrap in the tutorial is struck out, as if
>>>>>>> it
>>>>>>> is
>>>>>>> deprecated, but obviously it is not so. After some reasoning out I
>>>>>>> created a
>>>>>>> new MyBootstrap class which implements Bootstrap and implements its
>>>>>>> methods.
>>>>>>> Ran again mvn install and tried to deploy it again and it worked (I
>>>>>>> think).
>>>>>>>
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> --> now as you are telling me this I can remember I had the same
>>>>>> problems and I did solve them by adding my own bootstrap class. You
>>>>>> did
>>>>>> it correctly I think. Maybe gnodet or some other dev can tell you why
>>>>>> the archetype for the BC isn't working as it should.
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> 8. Create the SU.
>>>>>>>
>>>>>>> The steps to create the SU are missing. Guesswork again, I jumped
>>>>>>> around
>>>>>>> to
>>>>>>> the Hello World SE tutorial instead. I again assume it is the same
>>>>>>> for
>>>>>>> both
>>>>>>> BC and SE. From now on I am practically on my own jumping from other
>>>>>>> tutorials and trying to figure things out the hard way:
>>>>>>>
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> --> wow, you are right. I really over-read this fact. It will be
>>>>>> added
>>>>>> soon.
>>>>>> Basically you can use the archetype "servicemix-service-unit" for the
>>>>>> SU
>>>>>> creation in this case.
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> I added the following dependency to pom.xml of hello-world-su:
>>>>>>>
>>>>>>>     
>>>>>>>       org.apache.servicemix.samples.helloworld.bc
>>>>>>>       hello-world-bc
>>>>>>>       1.0-SNAPSHOT
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> --> yes, this is correct if the version of your bc is really
>>>>>> 1.0-SNAPSHOT
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>>     
>>>>>>>
>>>>>>> I added a new xbean.xml file under the resources folder of
>>>>>>> hello-world-su:
>>>>>>>
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> --> also done correctly. I suppose you used the
>>>>>> servicemix-service-unit
>>>>>> archetype which doesn't provide an own xbean.xml. But you may copy
>>>>>> almost any other xbean...for example the xbean of the file-poller or
>>>>>> something similar. Be sure to adapt the xbean file correctly as it
>>>>>> uses
>>>>>> some annotations of the endpoint classes.
>>>>>> In this case the endpoint should be defined:
>>>>>>
>>>>>> <component:provider ......
>>>>>>
>>>>>> or
>>>>>>
>>>>>> <component:consumer ......
>>>>>>
>>>>>> The component comes from the
>>>>>>
>>>>>> /**
>>>>>>  * @org.apache.xbean.XBean element="component"
>>>>>>  */
>>>>>> public class MyComponent extends DefaultComponent {
>>>>>>
>>>>>> --> see the annotation, it will be used.
>>>>>>
>>>>>>
>>>>>> for provider or consumer see the corresponding classes
>>>>>> MyConsumerEndpoint and MyProviderEndpoint...it's same there.
>>>>>>
>>>>>> Also have a look at your BC's pom.xml file. There is a important
>>>>>> section
>>>>>> to get your namespace for the SU:
>>>>>>
>>>>>>     ....
>>>>>>      <plugin>
>>>>>>         <groupId>org.apache.xbean</groupId>
>>>>>>         <artifactId>maven-xbean-plugin</artifactId>
>>>>>>         <version>${xbean-version}</version>
>>>>>>         <executions>
>>>>>>           <execution>
>>>>>>             <configuration>
>>>>>>
>>>>>> --> see here the namespace, adapt it if you need to:
>>>>>>               <namespace>http://${packageName}/1.0</namespace>
>>>>>>
>>>>>>             </configuration>
>>>>>>             <goals>
>>>>>>               <goal>mapping</goal>
>>>>>>             </goals>
>>>>>>           </execution>
>>>>>>         </executions>
>>>>>>       </plugin>
>>>>>>     ....
>>>>>>
>>>>>> This namespace will be used in your SU's xbean.xml. Just replace the
>>>>>> part after the xmlns:something="..." with your namespace set in the
>>>>>> BC's
>>>>>> pom.
>>>>>>
>>>>>> <?xml version="1.0"?>
>>>>>> <beans xmlns:something="someuri">
>>>>>>       <component:consumer ....
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>>   
>>>>>>>
>>>>>>>
>>>>>>> Again even the Hello World SE tutorial has lots of explanations
>>>>>>> missing.
>>>>>>>
>>>>>>> I assume I am done with the SU and try mvn install in its directory.
>>>>>>>
>>>>>>>
>>>>>>> 9. Create the SA
>>>>>>>
>>>>>>> Back to the original Hello World BC tutorial again.
>>>>>>> Created the SA through Maven OK. 
>>>>>>>
>>>>>>> In the tutorial there is the following confusing statement:
>>>>>>>
>>>>>>> The hello-world-smx directory should now contain the following two
>>>>>>> directories: 
>>>>>>> $ ls 
>>>>>>> hello-world-sa hello-world-bc
>>>>>>> If the SU is needed, where is its directory??
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> --> it seems the author saw that the SU creation isn't in the wiki so
>>>>>> he
>>>>>> skipped it here as well. of course the SU directory is missing here.
>>>>>>
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> The tutorial proceeds with stating that the following needs to be
>>>>>>> added
>>>>>>> to
>>>>>>> the SA pom.xml:
>>>>>>>
>>>>>>>     
>>>>>>>       org.apache.servicemix.samples.helloworld.bc
>>>>>>>       hello-world-bc
>>>>>>>       1.0-SNAPSHOT
>>>>>>>     
>>>>>>>
>>>>>>> What about the SU??
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> Imho this also makes no sense to me, but maybe there are existing
>>>>>> other
>>>>>> deployment methods which make it possible.
>>>>>> The SA should only have the SU as dependency. The BC is a dependency
>>>>>> of
>>>>>> the SU.
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> I proceed blindly with mvn install within the SA directory.
>>>>>>>
>>>>>>> 10. The top level project
>>>>>>>
>>>>>>> The tutorial states: Now that we have created the SU and SA projects
>>>>>>> a
>>>>>>> top
>>>>>>> level pom.xml must be manually created and made aware of each
>>>>>>> subproject.
>>>>>>> pom.xml needs to be edited to include each subproject.
>>>>>>>
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> --> there is an open JIRA for having such a super pom archetype.
>>>>>> Until
>>>>>> it is solved you have to do it manually.
>>>>>>
>>>>>> The pom should look like this:
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <project xmlns="http://maven.apache.org/POM/4.0.0" 
>>>>>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>>>>>> http://maven.apache.org/maven-v4_0_0.xsd">
>>>>>>
>>>>>>   <modelVersion>4.0.0</modelVersion>
>>>>>>
>>>>>>   <groupId>org.apache.servicemix.samples.helloworld</groupId>
>>>>>>   <artifactId>hello-world-smx</artifactId>
>>>>>>   <packaging>pom</packaging>
>>>>>>   <version>1.0-SNAPSHOT</version>
>>>>>>   <name>Hello World JBI Component</name>
>>>>>>
>>>>>>   <modules>
>>>>>>     <module>hello-world-bc</module>
>>>>>>     <module>hello-world-su</module>
>>>>>>     <module>hello-world-sa</module>
>>>>>>   </modules>
>>>>>>
>>>>>> </project>
>>>>>>
>>>>>>
>>>>>> Remember this is only a build tool's instruction file. It has nothing
>>>>>> to
>>>>>> do with smx at this moment. It builds the BC first, then the SU and
>>>>>> finally the SA so all the internal dependencies are fine.
>>>>>>
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>
>>>>>>>
>>>>>>>   4.0.0
>>>>>>>
>>>>>>>   org.apache.servicemix.samples.helloworld
>>>>>>>   hello-world-smx
>>>>>>>   pom
>>>>>>>   1.0-SNAPSHOT
>>>>>>>   Hello World JBI Component
>>>>>>>
>>>>>>>   
>>>>>>>     hello-world-sa
>>>>>>>     hello-world-bc
>>>>>>>   
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Again, where is the SU?
>>>>>>>
>>>>>>> The tutorial proceeds further stating that an ls should list the
>>>>>>> following
>>>>>>> files.
>>>>>>>
>>>>>>> $ ls 
>>>>>>> hello-world-sa hello-world-bc pom.xml
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> no, it better should be:
>>>>>>
>>>>>> $ ls 
>>>>>> hello-world-bc hello-world-sa hello-world-su pom.xml
>>>>>>
>>>>>>
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> If the SU is needed, where is it going to be included?
>>>>>>>
>>>>>>>
>>>>>>> 11. Give Each of the Maven Subprojects a Name
>>>>>>> 12. mvn clean install of the root folder 
>>>>>>>
>>>>>>> 13. Deploying the Component 
>>>>>>>
>>>>>>> Now that the SA is built, we're ready to deploy it to the JBI
>>>>>>> container. 
>>>>>>> This is a work in progress. I will finish this up very soon.
>>>>>>>
>>>>>>> Again missing information.
>>>>>>>
>>>>>>> I just copied hello-world-sa-1.0-SNAPSHOT.jar.
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> You have to copy the BC and the SA zip files to the hotdeploy folder.
>>>>>>
>>>>>>
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> At this point I am really looking forward to test the component out,
>>>>>>> so
>>>>>>> I
>>>>>>> just modified MySpringComponentTest to use the
>>>>>>> RemoteServiceMixClient
>>>>>>> in
>>>>>>> this way:
>>>>>>>
>>>>>>> RemoteServiceMixClient rc = new 
>>>>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>>>>
>>>>>>> I am shooting blindly at this point since I am not sure what the
>>>>>>> QName
>>>>>>> URN
>>>>>>> should be etc., but assuming that it worked before on the
>>>>>>> DefaultServiceMixClient I try it out just the same.
>>>>>>>
>>>>>>> I get the following error:
>>>>>>>
>>>>>>> 3253 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>>>>> ServiceName
>>>>>>> ({urn:test}service) specified for routing, but can't find it
>>>>>>> registered
>>>>>>> ...
>>>>>>> javax.jbi.messaging.MessagingException: Could not find route for
>>>>>>> exchange:
>>>>>>> InOut[
>>>>>>>   id: ID:10.0.0.1-1191902c607-3:0
>>>>>>>   status: Active
>>>>>>>   role: provider
>>>>>>>   service: {urn:test}service
>>>>>>>   in: <?xml version="1.0" encoding="UTF-8"?>world
>>>>>>> ] for service: {urn:test}service and interface: null
>>>>>>> 	at
>>>>>>> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
>>>>>>> 	at
>>>>>>> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
>>>>>>> ...
>>>>>>>
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> --> the endpoint uri was wrong. See my above comments about the
>>>>>> namespace thing.
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> With all the assumptions and guesswork I had to do, this tutorial is
>>>>>>> definitely NOT straightforward. I would appreciate if someone could
>>>>>>> correct
>>>>>>> me where I did a wrong step and tell me what I have to do to
>>>>>>> eventually
>>>>>>> test
>>>>>>> the component with RemoteServiceMixClient.
>>>>>>>
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>> --> you are right. it really needs a rework.
>>>>>>
>>>>>> Regards
>>>>>> Lars
>>>>>>
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> Thanks.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> lhe77 wrote:
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>>>> Yes, the service unit is needed because it configures the BC.
>>>>>>>> I had a look at the Hello World BC wiki page and it looks not that
>>>>>>>> bad
>>>>>>>> as you described it.
>>>>>>>>
>>>>>>>> Maybe you did not really understand how BC/SE, SU and SA plays
>>>>>>>> together.
>>>>>>>> BC and SE are engines, which are deployed to the smx. But when
>>>>>>>> doing
>>>>>>>> it,
>>>>>>>> it does not
>>>>>>>> mean that you have then a working Hello World example. For doing
>>>>>>>> such
>>>>>>>> example you have to deploy a Hello World ServiceUnit which
>>>>>>>> configures
>>>>>>>> an
>>>>>>>> endpoint using the BC in a ServiceAssembly.
>>>>>>>>
>>>>>>>> Please re-read the whole wiki page and don't skip out things. If
>>>>>>>> you
>>>>>>>> still have problems please describe what you already did and what's
>>>>>>>> the
>>>>>>>> problem exactly.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> Lars
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> jbx schrieb:
>>>>>>>>     
>>>>>>>>       
>>>>>>>>           
>>>>>>>>               
>>>>>>>>> Hi all,
>>>>>>>>>
>>>>>>>>> First of all I am a newbie, so please ignore my ignorance if my
>>>>>>>>> question
>>>>>>>>> is
>>>>>>>>> obvious.
>>>>>>>>>
>>>>>>>>> I have tried to follow the HelloWorld-BC tutorial but it is quite
>>>>>>>>> incomplete, so I hope to close the gaps here. I tried to look
>>>>>>>>> around
>>>>>>>>> and
>>>>>>>>> lots of people seemed to have problems too but there are no clear
>>>>>>>>> answers
>>>>>>>>> to
>>>>>>>>> my questions.
>>>>>>>>>
>>>>>>>>> 1. Is the Service Unit needed? If yes can I follow some other
>>>>>>>>> tutorial
>>>>>>>>> to
>>>>>>>>> get it done? I tried to follow the steps from other tutorials, but
>>>>>>>>> not
>>>>>>>>> sure
>>>>>>>>> if I omitted something. In the Hello-World-BC tutorial there is
>>>>>>>>> just
>>>>>>>>> this:
>>>>>>>>>
>>>>>>>>> == 1. Creating a Hello World BC Service Unit 
>>>>>>>>> This is a work in progress 
>>>>>>>>>
>>>>>>>>> 2. What are the steps to deploy the BC into the actual ServiceMix?
>>>>>>>>> Same
>>>>>>>>> problem with the documentation:
>>>>>>>>>
>>>>>>>>> == Deploying the Component 
>>>>>>>>> Now that the SA is built, we're ready to deploy it to the JBI
>>>>>>>>> container. 
>>>>>>>>>
>>>>>>>>> This is a work in progress. I will finish this up very soon
>>>>>>>>>
>>>>>>>>> I tried to reason things out and got to a point where I finally
>>>>>>>>> got
>>>>>>>>> ServiceMix to load my hello-world-sa (created the missing
>>>>>>>>> MyBootstrap.java
>>>>>>>>> etc.) However I must have missed something.
>>>>>>>>>
>>>>>>>>> I modified the MySpringComponentTest to use the
>>>>>>>>> RemoteServiceMixClient
>>>>>>>>> instead to access the ServiceMix JVM:
>>>>>>>>>
>>>>>>>>> RemoteServiceMixClient rc = new 
>>>>>>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>>>>>>
>>>>>>>>>  but I just got this error:
>>>>>>>>>
>>>>>>>>> 4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>>>>>>> ServiceName
>>>>>>>>> ({urn:test}service) specified for routing, but can't find it
>>>>>>>>> registered
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I suspect that this is something related to endpoints and the way
>>>>>>>>> the
>>>>>>>>> BC
>>>>>>>>> was
>>>>>>>>> deployed, but I have no idea what to do next.
>>>>>>>>>
>>>>>>>>> In the end I just want to learn how to develop my own BC for a
>>>>>>>>> specific
>>>>>>>>> protocol and have it accessible on the [ServiceMix] ESB from other
>>>>>>>>> clients
>>>>>>>>> remotely.
>>>>>>>>>
>>>>>>>>> Thanks.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>   
>>>>>>>>>       
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>>>                 
>>>>>>>>     
>>>>>>>>       
>>>>>>>>           
>>>>>>>>               
>>>>>>>   
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>     
>>>>>         
>>>>   
>>>>       
>>>     
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16538817.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: HelloWorld BC

Posted by Lars Heinemann <la...@compart.net>.
No problem at all.
See my answers inline...


jbx schrieb:
> Hi Lars,
>
> Sorry for being so pedantic... but I am really trying to understand the
> details properly.
>
> 1. I dont have anything like this:    
> xmlns:cp="http://www.compart.net/ns/jbi"
> in my xbean.xml (from the example) I have xmlns:xyz="http://companyxyz.com"
> This obviously does not exist.  (What is it anyway?)
>
>   
--> of course you don't have this because it's a namespace I use in my
local project.
You should replace the xmlns:xyz with for example xmlns:test. This test
is only the prefix for the tags which may follow now. Replace the
"http://companyxyz.com" with the namespace you have in the pom.xml of
your binding component. See there the namespace tag.



> Can I remove it? When I take it off my IDE complains that the <beans> tag is
> not declared. However if I leave it there the IDE complains that
> http://companyxyz.com does not exist (obviously). What should it be?
>
>   
--> the beans tag is of course needed. You can't remove it.
> 2. I discovered that under ~\hello-world-smx\hello-world-bc\target\xbean
> there is a file hello-world-bc.xsd. I set my IDE to map
> http://org.apache.servicemix.samples.helloworld.bc/1.0 to that local path.
>
> Now the IDE can help me autocomplete a valid xbean.xml.
>
> I followed your previous instructions and I now have something like this:
>
> <beans xmlns:hwbc="http://org.apache.servicemix.samples.helloworld.bc/1.0" 
>          xmlns:xyz="http://companyxyz.com">
>
>     <hwbc:provider service="" endpoint="" definition="" 
>                  component="" description="" id="" 
>                  interfaceName="" serviceUnit="" xml:lang="">
>
>   </hwbc:provider>
> </beans>
>
>   
--> in the above code you set the prefix "hwbc" to your namespace
"http://org.apache.servicemix.samples.helloworld.bc/1.0". The other
namespace "xyz" is only needed to route a message to another service for
example.

The definition you have now is okay for the basics, but you need to
configure it now properly.

> How do you know what to put in there? What is the correct service, endpoint,
> interfaceName etc. in my case and from where should I get it?
>
>   
--> for the beginning you just name the service, this service unit
provides. Lets say it will be the Hello-Service. So adapt the service
attribute to be "xyz:hello". xyz is now your namespace of choice and the
hello is the service name of this SU.
Now give the endpoint a name: "consumerEndpoint" will do for now.

Forget about the other attributes as I never needed them before and
maybe you won't need them for now as well.

> 3. How did you get these custom properties through your component in the
> provider definition?
>
>                  period="10000"
>                  debugMode="false"
>                  connection="imaps://me@myserver/INBOX?password=pass"
>                  deleteProcessedMessages="false"
>                  processOnlyUnseenMessages="true" />
>
> When I develop my own BC I will obviously need to specify my custom
> properties to set it up (connection settings etc). No idea how to go about
> that and the tutorial obviously doesnt include that yet.
>
>   
--> yes, you will need add. properties most of the time.
To have such properties injected to your endpoint's config you have to
do the following...
For example to define a String property:

In your endpoint class define a String property...

private String logPath;

Now add public getter and setter for this property. (most IDE will offer
you this)

public String getLogPath() { return this.logPath; }
public void setLogPath(String logPath) { this.logPath = logPath; }

Now you can refer from your xbean to this property by doing this:

<hwbc:provider service="xyz:hello" endpoint="consumerEndpoint" logPath="/tmp/">


> 4. The xsd specifies 3 main tags, the Provider, the Consumer and the
> Component. I suppose that the Consumer is required when the
> MyConsumerEndpoint needs to be used. What about the Component? Do I need to
> have it in the xbean.xml? When should it be used and what is it for?
>
>   
To be honest I never had it specified in my xbean files. No real idea
what are they for.
Maybe it's for the component attribute of the endpoint.

> Again, apologies for getting stuck so much. At least it might help you close
> some gaps for the next version of the Hello World BC tutorial :)
>
>
>   
You are also welcome to add unclear things to the todo list.

Regards
Lars



>
>
>
>
> lhe77 wrote:
>   
>> Ok, I will give you a quick example:
>>
>> I developed for example a servicemix-mail binding component.
>> There are 2 kind of endpoint types known by the mail component...
>> The poller will serve as the example:
>>
>> /**
>>  * This is the polling endpoint for the mail component.
>>  *
>>  * @org.apache.xbean.XBean element="poller"
>>  * @author lhein
>>  */
>> public class MailPollerEndpoint extends PollingEndpoint implements
>> MailEndpointType {
>> ....
>> }
>>
>> See the annotation element = "poller". This defines how the endpoint is
>> refered to from inside your SU's xbean.xml.
>> It looks like this:
>>
>> <?xml version="1.0"?>
>> <beans xmlns:mail="http://servicemix.apache.org/mail/1.0"
>>     xmlns:cp="http://www.compart.net/ns/jbi">
>>
>>     <mail:poller service="cp:email" endpoint="emailPollEndpoint"
>>                  targetService="cp:inputRouter"
>>                  targetOperation="cp:process"
>>                  period="10000"
>>                  debugMode="false"
>>                  connection="imaps://me@myserver/INBOX?password=pass"
>>                  deleteProcessedMessages="false"
>>                  processOnlyUnseenMessages="true" />
>>     </mail:poller>
>> </beans>
>>
>> You can see here the
>>     <mail:poller ...
>> where you find the term "poller" again. It means you refer to the
>> MailPollerEndpoint.java class.
>>
>> Where does the <mail: comes from? Look at the pom.xml of the
>> servicemix-mail binding component.
>> You will find a section like this:
>>
>>      <plugin>
>>         <groupId>org.apache.xbean</groupId>
>>         <artifactId>maven-xbean-plugin</artifactId>
>>         <version>${xbean-version}</version>
>>         <executions>
>>           <execution>
>>             <goals>
>>               <goal>mapping</goal>
>>             </goals>
>>             <configuration>
>>               <namespace>http://servicemix.apache.org/mail/1.0</namespace>
>>             </configuration>
>>           </execution>
>>         </executions>
>>       </plugin>
>>
>> Look at the namespace tag. And now look at the xbean.xml above and you
>> will find exactly this namespace defined to be the mail namespace:
>>
>> <beans xmlns:mail="http://servicemix.apache.org/mail/1.0" ...
>>
>> I hope this clarifies the usage a little. If you have further problems,
>> just let us know.
>>
>> Regards
>> Lars
>>
>>
>>
>> jbx schrieb:
>>     
>>> Hi Lars,
>>>
>>> I noticed that the Hello World BC has been updated with a long list of
>>> TODOs
>>> :)
>>>
>>> I am still struggling to get the xbean.xml configured correctly
>>> (hopefully I
>>> manage today by syndicating some other tutorials and documentation around
>>> combined with guesswork). I didnt quite understand your <component:...>
>>> part
>>> and dont know what to add in my xbean yet. I strongly suggest that in the
>>> tutorial the full working xbean.xml for the SU is put.
>>>
>>> I tried to go to jconsole but (I suppose because of the xbean problem)
>>> the
>>> HelloWorld endpoint is missing from the list of endpoints under
>>> ServiceMix->Endpoint.
>>>
>>> I also tried to follow the namespace (from the BC) but
>>> http://org.apache.servicemix.samples.helloworld.bc/1.0 does not exist so
>>> not
>>> even my IDE can auto-complete the tags.
>>>
>>> If you are developing your own BC, how do you create your namespace? I
>>> dont
>>> think it should be referring to servicemix.samples.helloworld.bc right?
>>>
>>> Thanks again.
>>>
>>>
>>>
>>>
>>> lhe77 wrote:
>>>   
>>>       
>>>> For your testing error:
>>>>
>>>> Open up a jconsole and connect to your running smx instance.
>>>> Then browse to:
>>>>
>>>> org.apache.servicemix > ServiceMix > Endpoint
>>>>
>>>> There watch out for your helloWorld endpoint.
>>>> Select and expand the item to External and select the
>>>> Attributes node.
>>>>
>>>> Now you can see the serviceName of the endpoint in the list to the
>>>> right.
>>>> This is the uri to send the test messages to I think.
>>>>
>>>> Just to show you also the JMX opportunities of the smx. :)
>>>>
>>>> Regards
>>>> Lars
>>>>
>>>>
>>>>
>>>> Lars Heinemann schrieb:
>>>>     
>>>>         
>>>>> I think now I better understand your point of view.
>>>>> The tutorial really lacks some important information and is also
>>>>> plain wrong in some descriptions. I will update this tutorial asap.
>>>>>
>>>>> For the meanwhile...see my comments inside your mail:
>>>>>
>>>>>
>>>>> jbx schrieb:
>>>>>   
>>>>>       
>>>>>           
>>>>>> Hi Lars, 
>>>>>>
>>>>>> The fact that you have to skip from one tutorial to another trying to
>>>>>> 'infer' how things should be done (apart from the fact that the latest
>>>>>> Maven
>>>>>> and its Archetypes do not match the tutorial) simply confuses newbies
>>>>>> and
>>>>>> creates immense frustration instead of appreciation of the strength of
>>>>>> the
>>>>>> technology they're trying to learn. 
>>>>>>
>>>>>> How should someone who has just heard about a Service Unit suddenly
>>>>>> become
>>>>>> an expert and 'know' how to do the SU for a BC if it is not in the
>>>>>> tutorial?
>>>>>>
>>>>>> Just to verify that I am not missing anything out I have done
>>>>>> everything
>>>>>> from scratch again, sorry if its long:
>>>>>>
>>>>>> 1. Created directory hello-world-smx and changed the working directory
>>>>>> to
>>>>>> it.
>>>>>> 2. Created the servicemix-binding-component archetype from maven
>>>>>>  
>>>>>> Problem: This does not work:
>>>>>>
>>>>>> mvn archetype:create \ 
>>>>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>>>>> -DarchetypeArtifactId=servicemix-binding-component \
>>>>>> -DarchetypeVersion=3.2.1 \
>>>>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>>>>> -DartifactId=hello-world-bc 
>>>>>>
>>>>>> To follow the tutorial in the same way it has to be:
>>>>>> mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create
>>>>>> \ 
>>>>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>>>>> -DarchetypeArtifactId=servicemix-binding-component \
>>>>>> -DarchetypeVersion=3.2.1 \
>>>>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>>>>> -DartifactId=hello-world-bc 
>>>>>>
>>>>>> It worked for the Getting Started tutorials, so I guess nothing wrong
>>>>>> with
>>>>>> the above.
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> --> This is a known issue for which even a JIRA exists. The solution
>>>>> you
>>>>> choose was correct.
>>>>>       I will put a hint to the section in the tutorial.
>>>>>
>>>>>
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>> 3. mvn install worked.
>>>>>> 4. created the respective IDE project file: mvn idea:idea
>>>>>> 5. modified MyProviderEndpoint.processInOut() accordingly
>>>>>> 6. modified MySpringComponentTest accordingly and performed mvn
>>>>>> install
>>>>>>
>>>>>> When executing MySpringComponentTest it works fine and the
>>>>>> hello-world-bc
>>>>>> converts the message.
>>>>>>
>>>>>> 7. Deploying the BC to ServiceMix. 
>>>>>>
>>>>>> It is not clear if the BC is separate to the SU or the SU is a zip
>>>>>> file
>>>>>> which also contains the BC. In this tutorial it states that mvn
>>>>>> install
>>>>>> has
>>>>>> created an install zip file which can be deployed into servicemix, but
>>>>>> this
>>>>>> does not complete the deployment of the BC since it needs an SU. 
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> --> imho the BC should be deployed standalone as it should a generic
>>>>> protocol bridge
>>>>> which may be used by several other service units. The zip file of the
>>>>> bc
>>>>> is just dropped to the hotdeploy folder of your smx installation and
>>>>> will be deployed automatically.
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>> From other places on the service-mix site I learnt that an SU is
>>>>>> essentially
>>>>>> like a war file. So one thinks, should I create the SU before
>>>>>> deploying
>>>>>> the
>>>>>> BC into servicemix and deploy 1 zip file (like we do for a webapp)
>>>>>> which
>>>>>> contains the SU which in itself contains the BC. This is quite
>>>>>> confusing.
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> --> no, the BC should be the first step to create. when the bc is
>>>>> deployed you may create a SU and the SA which is in fact only a deploy
>>>>> format for the SU and the SA's zip will be dropped into the hotdeploy
>>>>> folder as well. If the dependency settings of your SU are pointing to
>>>>> your BC then it should even tell you if the BC is not deployed to smx.
>>>>> You can try it if you remove the BC and try to deploy only the SA. smx
>>>>> will tell you in the console that it now awaits the deployment of the
>>>>> hello-world-bc before finishing the deployment of the SA.
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>> I put the BC install file into servicemix /hotdeploy, even though this
>>>>>> seems
>>>>>> to contradict the above reasoning, but I guess I misunderstood
>>>>>> something
>>>>>> here.
>>>>>>
>>>>>> Problem:
>>>>>>
>>>>>> ERROR - InstallerMBeanImpl             - Class not found:
>>>>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>>>>> java.lang.ClassNotFoundException:
>>>>>> org.apache.servicemix.samples.helloworld.bc.My
>>>>>> Bootstrap in classloader
>>>>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>>>>>         at
>>>>>> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
>>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>>>>>         at
>>>>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.createBootstrap(InstallerMBeanImpl.java:120)
>>>>>>         at
>>>>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.(InstallerMBeanImpl.java:68)
>>>>>>         at
>>>>>> org.apache.servicemix.jbi.framework.InstallationService.initializeInstaller(InstallationService.java:447)
>>>>>>         at
>>>>>> org.apache.servicemix.jbi.framework.InstallationService.doInstallComp
>>>>>> onent(InstallationService.java:429)
>>>>>>         ...
>>>>>>
>>>>>> The only reference to Bootstrap in the tutorial is struck out, as if
>>>>>> it
>>>>>> is
>>>>>> deprecated, but obviously it is not so. After some reasoning out I
>>>>>> created a
>>>>>> new MyBootstrap class which implements Bootstrap and implements its
>>>>>> methods.
>>>>>> Ran again mvn install and tried to deploy it again and it worked (I
>>>>>> think).
>>>>>>
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> --> now as you are telling me this I can remember I had the same
>>>>> problems and I did solve them by adding my own bootstrap class. You did
>>>>> it correctly I think. Maybe gnodet or some other dev can tell you why
>>>>> the archetype for the BC isn't working as it should.
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>> 8. Create the SU.
>>>>>>
>>>>>> The steps to create the SU are missing. Guesswork again, I jumped
>>>>>> around
>>>>>> to
>>>>>> the Hello World SE tutorial instead. I again assume it is the same for
>>>>>> both
>>>>>> BC and SE. From now on I am practically on my own jumping from other
>>>>>> tutorials and trying to figure things out the hard way:
>>>>>>
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> --> wow, you are right. I really over-read this fact. It will be added
>>>>> soon.
>>>>> Basically you can use the archetype "servicemix-service-unit" for the
>>>>> SU
>>>>> creation in this case.
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>> I added the following dependency to pom.xml of hello-world-su:
>>>>>>
>>>>>>     
>>>>>>       org.apache.servicemix.samples.helloworld.bc
>>>>>>       hello-world-bc
>>>>>>       1.0-SNAPSHOT
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> --> yes, this is correct if the version of your bc is really
>>>>> 1.0-SNAPSHOT
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>>     
>>>>>>
>>>>>> I added a new xbean.xml file under the resources folder of
>>>>>> hello-world-su:
>>>>>>
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> --> also done correctly. I suppose you used the servicemix-service-unit
>>>>> archetype which doesn't provide an own xbean.xml. But you may copy
>>>>> almost any other xbean...for example the xbean of the file-poller or
>>>>> something similar. Be sure to adapt the xbean file correctly as it uses
>>>>> some annotations of the endpoint classes.
>>>>> In this case the endpoint should be defined:
>>>>>
>>>>> <component:provider ......
>>>>>
>>>>> or
>>>>>
>>>>> <component:consumer ......
>>>>>
>>>>> The component comes from the
>>>>>
>>>>> /**
>>>>>  * @org.apache.xbean.XBean element="component"
>>>>>  */
>>>>> public class MyComponent extends DefaultComponent {
>>>>>
>>>>> --> see the annotation, it will be used.
>>>>>
>>>>>
>>>>> for provider or consumer see the corresponding classes
>>>>> MyConsumerEndpoint and MyProviderEndpoint...it's same there.
>>>>>
>>>>> Also have a look at your BC's pom.xml file. There is a important
>>>>> section
>>>>> to get your namespace for the SU:
>>>>>
>>>>>     ....
>>>>>      <plugin>
>>>>>         <groupId>org.apache.xbean</groupId>
>>>>>         <artifactId>maven-xbean-plugin</artifactId>
>>>>>         <version>${xbean-version}</version>
>>>>>         <executions>
>>>>>           <execution>
>>>>>             <configuration>
>>>>>
>>>>> --> see here the namespace, adapt it if you need to:
>>>>>               <namespace>http://${packageName}/1.0</namespace>
>>>>>
>>>>>             </configuration>
>>>>>             <goals>
>>>>>               <goal>mapping</goal>
>>>>>             </goals>
>>>>>           </execution>
>>>>>         </executions>
>>>>>       </plugin>
>>>>>     ....
>>>>>
>>>>> This namespace will be used in your SU's xbean.xml. Just replace the
>>>>> part after the xmlns:something="..." with your namespace set in the
>>>>> BC's
>>>>> pom.
>>>>>
>>>>> <?xml version="1.0"?>
>>>>> <beans xmlns:something="someuri">
>>>>>       <component:consumer ....
>>>>>   
>>>>>       
>>>>>           
>>>>>>   
>>>>>>
>>>>>>
>>>>>> Again even the Hello World SE tutorial has lots of explanations
>>>>>> missing.
>>>>>>
>>>>>> I assume I am done with the SU and try mvn install in its directory.
>>>>>>
>>>>>>
>>>>>> 9. Create the SA
>>>>>>
>>>>>> Back to the original Hello World BC tutorial again.
>>>>>> Created the SA through Maven OK. 
>>>>>>
>>>>>> In the tutorial there is the following confusing statement:
>>>>>>
>>>>>> The hello-world-smx directory should now contain the following two
>>>>>> directories: 
>>>>>> $ ls 
>>>>>> hello-world-sa hello-world-bc
>>>>>> If the SU is needed, where is its directory??
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> --> it seems the author saw that the SU creation isn't in the wiki so
>>>>> he
>>>>> skipped it here as well. of course the SU directory is missing here.
>>>>>
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>> The tutorial proceeds with stating that the following needs to be
>>>>>> added
>>>>>> to
>>>>>> the SA pom.xml:
>>>>>>
>>>>>>     
>>>>>>       org.apache.servicemix.samples.helloworld.bc
>>>>>>       hello-world-bc
>>>>>>       1.0-SNAPSHOT
>>>>>>     
>>>>>>
>>>>>> What about the SU??
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> Imho this also makes no sense to me, but maybe there are existing other
>>>>> deployment methods which make it possible.
>>>>> The SA should only have the SU as dependency. The BC is a dependency of
>>>>> the SU.
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>> I proceed blindly with mvn install within the SA directory.
>>>>>>
>>>>>> 10. The top level project
>>>>>>
>>>>>> The tutorial states: Now that we have created the SU and SA projects a
>>>>>> top
>>>>>> level pom.xml must be manually created and made aware of each
>>>>>> subproject.
>>>>>> pom.xml needs to be edited to include each subproject.
>>>>>>
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> --> there is an open JIRA for having such a super pom archetype. Until
>>>>> it is solved you have to do it manually.
>>>>>
>>>>> The pom should look like this:
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <project xmlns="http://maven.apache.org/POM/4.0.0" 
>>>>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>>>>> http://maven.apache.org/maven-v4_0_0.xsd">
>>>>>
>>>>>   <modelVersion>4.0.0</modelVersion>
>>>>>
>>>>>   <groupId>org.apache.servicemix.samples.helloworld</groupId>
>>>>>   <artifactId>hello-world-smx</artifactId>
>>>>>   <packaging>pom</packaging>
>>>>>   <version>1.0-SNAPSHOT</version>
>>>>>   <name>Hello World JBI Component</name>
>>>>>
>>>>>   <modules>
>>>>>     <module>hello-world-bc</module>
>>>>>     <module>hello-world-su</module>
>>>>>     <module>hello-world-sa</module>
>>>>>   </modules>
>>>>>
>>>>> </project>
>>>>>
>>>>>
>>>>> Remember this is only a build tool's instruction file. It has nothing
>>>>> to
>>>>> do with smx at this moment. It builds the BC first, then the SU and
>>>>> finally the SA so all the internal dependencies are fine.
>>>>>
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>
>>>>>>
>>>>>>   4.0.0
>>>>>>
>>>>>>   org.apache.servicemix.samples.helloworld
>>>>>>   hello-world-smx
>>>>>>   pom
>>>>>>   1.0-SNAPSHOT
>>>>>>   Hello World JBI Component
>>>>>>
>>>>>>   
>>>>>>     hello-world-sa
>>>>>>     hello-world-bc
>>>>>>   
>>>>>>
>>>>>>
>>>>>>
>>>>>> Again, where is the SU?
>>>>>>
>>>>>> The tutorial proceeds further stating that an ls should list the
>>>>>> following
>>>>>> files.
>>>>>>
>>>>>> $ ls 
>>>>>> hello-world-sa hello-world-bc pom.xml
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> no, it better should be:
>>>>>
>>>>> $ ls 
>>>>> hello-world-bc hello-world-sa hello-world-su pom.xml
>>>>>
>>>>>
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>> If the SU is needed, where is it going to be included?
>>>>>>
>>>>>>
>>>>>> 11. Give Each of the Maven Subprojects a Name
>>>>>> 12. mvn clean install of the root folder 
>>>>>>
>>>>>> 13. Deploying the Component 
>>>>>>
>>>>>> Now that the SA is built, we're ready to deploy it to the JBI
>>>>>> container. 
>>>>>> This is a work in progress. I will finish this up very soon.
>>>>>>
>>>>>> Again missing information.
>>>>>>
>>>>>> I just copied hello-world-sa-1.0-SNAPSHOT.jar.
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> You have to copy the BC and the SA zip files to the hotdeploy folder.
>>>>>
>>>>>
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>> At this point I am really looking forward to test the component out,
>>>>>> so
>>>>>> I
>>>>>> just modified MySpringComponentTest to use the RemoteServiceMixClient
>>>>>> in
>>>>>> this way:
>>>>>>
>>>>>> RemoteServiceMixClient rc = new 
>>>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>>>
>>>>>> I am shooting blindly at this point since I am not sure what the QName
>>>>>> URN
>>>>>> should be etc., but assuming that it worked before on the
>>>>>> DefaultServiceMixClient I try it out just the same.
>>>>>>
>>>>>> I get the following error:
>>>>>>
>>>>>> 3253 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>>>> ServiceName
>>>>>> ({urn:test}service) specified for routing, but can't find it
>>>>>> registered
>>>>>> ...
>>>>>> javax.jbi.messaging.MessagingException: Could not find route for
>>>>>> exchange:
>>>>>> InOut[
>>>>>>   id: ID:10.0.0.1-1191902c607-3:0
>>>>>>   status: Active
>>>>>>   role: provider
>>>>>>   service: {urn:test}service
>>>>>>   in: <?xml version="1.0" encoding="UTF-8"?>world
>>>>>> ] for service: {urn:test}service and interface: null
>>>>>> 	at
>>>>>> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
>>>>>> 	at
>>>>>> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
>>>>>> ...
>>>>>>
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> --> the endpoint uri was wrong. See my above comments about the
>>>>> namespace thing.
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>> With all the assumptions and guesswork I had to do, this tutorial is
>>>>>> definitely NOT straightforward. I would appreciate if someone could
>>>>>> correct
>>>>>> me where I did a wrong step and tell me what I have to do to
>>>>>> eventually
>>>>>> test
>>>>>> the component with RemoteServiceMixClient.
>>>>>>
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> --> you are right. it really needs a rework.
>>>>>
>>>>> Regards
>>>>> Lars
>>>>>
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> lhe77 wrote:
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>>> Yes, the service unit is needed because it configures the BC.
>>>>>>> I had a look at the Hello World BC wiki page and it looks not that
>>>>>>> bad
>>>>>>> as you described it.
>>>>>>>
>>>>>>> Maybe you did not really understand how BC/SE, SU and SA plays
>>>>>>> together.
>>>>>>> BC and SE are engines, which are deployed to the smx. But when doing
>>>>>>> it,
>>>>>>> it does not
>>>>>>> mean that you have then a working Hello World example. For doing such
>>>>>>> example you have to deploy a Hello World ServiceUnit which configures
>>>>>>> an
>>>>>>> endpoint using the BC in a ServiceAssembly.
>>>>>>>
>>>>>>> Please re-read the whole wiki page and don't skip out things. If you
>>>>>>> still have problems please describe what you already did and what's
>>>>>>> the
>>>>>>> problem exactly.
>>>>>>>
>>>>>>> Regards
>>>>>>> Lars
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> jbx schrieb:
>>>>>>>     
>>>>>>>       
>>>>>>>           
>>>>>>>               
>>>>>>>> Hi all,
>>>>>>>>
>>>>>>>> First of all I am a newbie, so please ignore my ignorance if my
>>>>>>>> question
>>>>>>>> is
>>>>>>>> obvious.
>>>>>>>>
>>>>>>>> I have tried to follow the HelloWorld-BC tutorial but it is quite
>>>>>>>> incomplete, so I hope to close the gaps here. I tried to look around
>>>>>>>> and
>>>>>>>> lots of people seemed to have problems too but there are no clear
>>>>>>>> answers
>>>>>>>> to
>>>>>>>> my questions.
>>>>>>>>
>>>>>>>> 1. Is the Service Unit needed? If yes can I follow some other
>>>>>>>> tutorial
>>>>>>>> to
>>>>>>>> get it done? I tried to follow the steps from other tutorials, but
>>>>>>>> not
>>>>>>>> sure
>>>>>>>> if I omitted something. In the Hello-World-BC tutorial there is just
>>>>>>>> this:
>>>>>>>>
>>>>>>>> == 1. Creating a Hello World BC Service Unit 
>>>>>>>> This is a work in progress 
>>>>>>>>
>>>>>>>> 2. What are the steps to deploy the BC into the actual ServiceMix?
>>>>>>>> Same
>>>>>>>> problem with the documentation:
>>>>>>>>
>>>>>>>> == Deploying the Component 
>>>>>>>> Now that the SA is built, we're ready to deploy it to the JBI
>>>>>>>> container. 
>>>>>>>>
>>>>>>>> This is a work in progress. I will finish this up very soon
>>>>>>>>
>>>>>>>> I tried to reason things out and got to a point where I finally got
>>>>>>>> ServiceMix to load my hello-world-sa (created the missing
>>>>>>>> MyBootstrap.java
>>>>>>>> etc.) However I must have missed something.
>>>>>>>>
>>>>>>>> I modified the MySpringComponentTest to use the
>>>>>>>> RemoteServiceMixClient
>>>>>>>> instead to access the ServiceMix JVM:
>>>>>>>>
>>>>>>>> RemoteServiceMixClient rc = new 
>>>>>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>>>>>
>>>>>>>>  but I just got this error:
>>>>>>>>
>>>>>>>> 4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>>>>>> ServiceName
>>>>>>>> ({urn:test}service) specified for routing, but can't find it
>>>>>>>> registered
>>>>>>>>
>>>>>>>>
>>>>>>>> I suspect that this is something related to endpoints and the way
>>>>>>>> the
>>>>>>>> BC
>>>>>>>> was
>>>>>>>> deployed, but I have no idea what to do next.
>>>>>>>>
>>>>>>>> In the end I just want to learn how to develop my own BC for a
>>>>>>>> specific
>>>>>>>> protocol and have it accessible on the [ServiceMix] ESB from other
>>>>>>>> clients
>>>>>>>> remotely.
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>         
>>>>>>>>             
>>>>>>>>                 
>>>>>>>     
>>>>>>>       
>>>>>>>           
>>>>>>>               
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>   
>>>>>       
>>>>>           
>>>>     
>>>>         
>>>   
>>>       
>>     
>
>   

Re: HelloWorld BC

Posted by jbx <jo...@gmail.com>.
Hi Lars,

Sorry for being so pedantic... but I am really trying to understand the
details properly.

1. I dont have anything like this:    
xmlns:cp="http://www.compart.net/ns/jbi"
in my xbean.xml (from the example) I have xmlns:xyz="http://companyxyz.com"
This obviously does not exist.  (What is it anyway?)

Can I remove it? When I take it off my IDE complains that the <beans> tag is
not declared. However if I leave it there the IDE complains that
http://companyxyz.com does not exist (obviously). What should it be?


2. I discovered that under ~\hello-world-smx\hello-world-bc\target\xbean
there is a file hello-world-bc.xsd. I set my IDE to map
http://org.apache.servicemix.samples.helloworld.bc/1.0 to that local path.

Now the IDE can help me autocomplete a valid xbean.xml.

I followed your previous instructions and I now have something like this:

<beans xmlns:hwbc="http://org.apache.servicemix.samples.helloworld.bc/1.0" 
         xmlns:xyz="http://companyxyz.com">

    <hwbc:provider service="" endpoint="" definition="" 
                 component="" description="" id="" 
                 interfaceName="" serviceUnit="" xml:lang="">

  </hwbc:provider>
</beans>

How do you know what to put in there? What is the correct service, endpoint,
interfaceName etc. in my case and from where should I get it?

3. How did you get these custom properties through your component in the
provider definition?

                 period="10000"
                 debugMode="false"
                 connection="imaps://me@myserver/INBOX?password=pass"
                 deleteProcessedMessages="false"
                 processOnlyUnseenMessages="true" />

When I develop my own BC I will obviously need to specify my custom
properties to set it up (connection settings etc). No idea how to go about
that and the tutorial obviously doesnt include that yet.


4. The xsd specifies 3 main tags, the Provider, the Consumer and the
Component. I suppose that the Consumer is required when the
MyConsumerEndpoint needs to be used. What about the Component? Do I need to
have it in the xbean.xml? When should it be used and what is it for?


Again, apologies for getting stuck so much. At least it might help you close
some gaps for the next version of the Hello World BC tutorial :)







lhe77 wrote:
> 
> Ok, I will give you a quick example:
> 
> I developed for example a servicemix-mail binding component.
> There are 2 kind of endpoint types known by the mail component...
> The poller will serve as the example:
> 
> /**
>  * This is the polling endpoint for the mail component.
>  *
>  * @org.apache.xbean.XBean element="poller"
>  * @author lhein
>  */
> public class MailPollerEndpoint extends PollingEndpoint implements
> MailEndpointType {
> ....
> }
> 
> See the annotation element = "poller". This defines how the endpoint is
> refered to from inside your SU's xbean.xml.
> It looks like this:
> 
> <?xml version="1.0"?>
> <beans xmlns:mail="http://servicemix.apache.org/mail/1.0"
>     xmlns:cp="http://www.compart.net/ns/jbi">
> 
>     <mail:poller service="cp:email" endpoint="emailPollEndpoint"
>                  targetService="cp:inputRouter"
>                  targetOperation="cp:process"
>                  period="10000"
>                  debugMode="false"
>                  connection="imaps://me@myserver/INBOX?password=pass"
>                  deleteProcessedMessages="false"
>                  processOnlyUnseenMessages="true" />
>     </mail:poller>
> </beans>
> 
> You can see here the
>     <mail:poller ...
> where you find the term "poller" again. It means you refer to the
> MailPollerEndpoint.java class.
> 
> Where does the <mail: comes from? Look at the pom.xml of the
> servicemix-mail binding component.
> You will find a section like this:
> 
>      <plugin>
>         <groupId>org.apache.xbean</groupId>
>         <artifactId>maven-xbean-plugin</artifactId>
>         <version>${xbean-version}</version>
>         <executions>
>           <execution>
>             <goals>
>               <goal>mapping</goal>
>             </goals>
>             <configuration>
>               <namespace>http://servicemix.apache.org/mail/1.0</namespace>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
> 
> Look at the namespace tag. And now look at the xbean.xml above and you
> will find exactly this namespace defined to be the mail namespace:
> 
> <beans xmlns:mail="http://servicemix.apache.org/mail/1.0" ...
> 
> I hope this clarifies the usage a little. If you have further problems,
> just let us know.
> 
> Regards
> Lars
> 
> 
> 
> jbx schrieb:
>> Hi Lars,
>>
>> I noticed that the Hello World BC has been updated with a long list of
>> TODOs
>> :)
>>
>> I am still struggling to get the xbean.xml configured correctly
>> (hopefully I
>> manage today by syndicating some other tutorials and documentation around
>> combined with guesswork). I didnt quite understand your <component:...>
>> part
>> and dont know what to add in my xbean yet. I strongly suggest that in the
>> tutorial the full working xbean.xml for the SU is put.
>>
>> I tried to go to jconsole but (I suppose because of the xbean problem)
>> the
>> HelloWorld endpoint is missing from the list of endpoints under
>> ServiceMix->Endpoint.
>>
>> I also tried to follow the namespace (from the BC) but
>> http://org.apache.servicemix.samples.helloworld.bc/1.0 does not exist so
>> not
>> even my IDE can auto-complete the tags.
>>
>> If you are developing your own BC, how do you create your namespace? I
>> dont
>> think it should be referring to servicemix.samples.helloworld.bc right?
>>
>> Thanks again.
>>
>>
>>
>>
>> lhe77 wrote:
>>   
>>> For your testing error:
>>>
>>> Open up a jconsole and connect to your running smx instance.
>>> Then browse to:
>>>
>>> org.apache.servicemix > ServiceMix > Endpoint
>>>
>>> There watch out for your helloWorld endpoint.
>>> Select and expand the item to External and select the
>>> Attributes node.
>>>
>>> Now you can see the serviceName of the endpoint in the list to the
>>> right.
>>> This is the uri to send the test messages to I think.
>>>
>>> Just to show you also the JMX opportunities of the smx. :)
>>>
>>> Regards
>>> Lars
>>>
>>>
>>>
>>> Lars Heinemann schrieb:
>>>     
>>>> I think now I better understand your point of view.
>>>> The tutorial really lacks some important information and is also
>>>> plain wrong in some descriptions. I will update this tutorial asap.
>>>>
>>>> For the meanwhile...see my comments inside your mail:
>>>>
>>>>
>>>> jbx schrieb:
>>>>   
>>>>       
>>>>> Hi Lars, 
>>>>>
>>>>> The fact that you have to skip from one tutorial to another trying to
>>>>> 'infer' how things should be done (apart from the fact that the latest
>>>>> Maven
>>>>> and its Archetypes do not match the tutorial) simply confuses newbies
>>>>> and
>>>>> creates immense frustration instead of appreciation of the strength of
>>>>> the
>>>>> technology they're trying to learn. 
>>>>>
>>>>> How should someone who has just heard about a Service Unit suddenly
>>>>> become
>>>>> an expert and 'know' how to do the SU for a BC if it is not in the
>>>>> tutorial?
>>>>>
>>>>> Just to verify that I am not missing anything out I have done
>>>>> everything
>>>>> from scratch again, sorry if its long:
>>>>>
>>>>> 1. Created directory hello-world-smx and changed the working directory
>>>>> to
>>>>> it.
>>>>> 2. Created the servicemix-binding-component archetype from maven
>>>>>  
>>>>> Problem: This does not work:
>>>>>
>>>>> mvn archetype:create \ 
>>>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>>>> -DarchetypeArtifactId=servicemix-binding-component \
>>>>> -DarchetypeVersion=3.2.1 \
>>>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>>>> -DartifactId=hello-world-bc 
>>>>>
>>>>> To follow the tutorial in the same way it has to be:
>>>>> mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create
>>>>> \ 
>>>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>>>> -DarchetypeArtifactId=servicemix-binding-component \
>>>>> -DarchetypeVersion=3.2.1 \
>>>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>>>> -DartifactId=hello-world-bc 
>>>>>
>>>>> It worked for the Getting Started tutorials, so I guess nothing wrong
>>>>> with
>>>>> the above.
>>>>>   
>>>>>     
>>>>>         
>>>> --> This is a known issue for which even a JIRA exists. The solution
>>>> you
>>>> choose was correct.
>>>>       I will put a hint to the section in the tutorial.
>>>>
>>>>
>>>>
>>>>   
>>>>       
>>>>> 3. mvn install worked.
>>>>> 4. created the respective IDE project file: mvn idea:idea
>>>>> 5. modified MyProviderEndpoint.processInOut() accordingly
>>>>> 6. modified MySpringComponentTest accordingly and performed mvn
>>>>> install
>>>>>
>>>>> When executing MySpringComponentTest it works fine and the
>>>>> hello-world-bc
>>>>> converts the message.
>>>>>
>>>>> 7. Deploying the BC to ServiceMix. 
>>>>>
>>>>> It is not clear if the BC is separate to the SU or the SU is a zip
>>>>> file
>>>>> which also contains the BC. In this tutorial it states that mvn
>>>>> install
>>>>> has
>>>>> created an install zip file which can be deployed into servicemix, but
>>>>> this
>>>>> does not complete the deployment of the BC since it needs an SU. 
>>>>>   
>>>>>     
>>>>>         
>>>> --> imho the BC should be deployed standalone as it should a generic
>>>> protocol bridge
>>>> which may be used by several other service units. The zip file of the
>>>> bc
>>>> is just dropped to the hotdeploy folder of your smx installation and
>>>> will be deployed automatically.
>>>>
>>>>   
>>>>       
>>>>> From other places on the service-mix site I learnt that an SU is
>>>>> essentially
>>>>> like a war file. So one thinks, should I create the SU before
>>>>> deploying
>>>>> the
>>>>> BC into servicemix and deploy 1 zip file (like we do for a webapp)
>>>>> which
>>>>> contains the SU which in itself contains the BC. This is quite
>>>>> confusing.
>>>>>   
>>>>>     
>>>>>         
>>>> --> no, the BC should be the first step to create. when the bc is
>>>> deployed you may create a SU and the SA which is in fact only a deploy
>>>> format for the SU and the SA's zip will be dropped into the hotdeploy
>>>> folder as well. If the dependency settings of your SU are pointing to
>>>> your BC then it should even tell you if the BC is not deployed to smx.
>>>> You can try it if you remove the BC and try to deploy only the SA. smx
>>>> will tell you in the console that it now awaits the deployment of the
>>>> hello-world-bc before finishing the deployment of the SA.
>>>>
>>>>   
>>>>       
>>>>> I put the BC install file into servicemix /hotdeploy, even though this
>>>>> seems
>>>>> to contradict the above reasoning, but I guess I misunderstood
>>>>> something
>>>>> here.
>>>>>
>>>>> Problem:
>>>>>
>>>>> ERROR - InstallerMBeanImpl             - Class not found:
>>>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>>>> java.lang.ClassNotFoundException:
>>>>> org.apache.servicemix.samples.helloworld.bc.My
>>>>> Bootstrap in classloader
>>>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>>>>         at
>>>>> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
>>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>>>>         at
>>>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.createBootstrap(InstallerMBeanImpl.java:120)
>>>>>         at
>>>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.(InstallerMBeanImpl.java:68)
>>>>>         at
>>>>> org.apache.servicemix.jbi.framework.InstallationService.initializeInstaller(InstallationService.java:447)
>>>>>         at
>>>>> org.apache.servicemix.jbi.framework.InstallationService.doInstallComp
>>>>> onent(InstallationService.java:429)
>>>>>         ...
>>>>>
>>>>> The only reference to Bootstrap in the tutorial is struck out, as if
>>>>> it
>>>>> is
>>>>> deprecated, but obviously it is not so. After some reasoning out I
>>>>> created a
>>>>> new MyBootstrap class which implements Bootstrap and implements its
>>>>> methods.
>>>>> Ran again mvn install and tried to deploy it again and it worked (I
>>>>> think).
>>>>>
>>>>>   
>>>>>     
>>>>>         
>>>> --> now as you are telling me this I can remember I had the same
>>>> problems and I did solve them by adding my own bootstrap class. You did
>>>> it correctly I think. Maybe gnodet or some other dev can tell you why
>>>> the archetype for the BC isn't working as it should.
>>>>
>>>>   
>>>>       
>>>>> 8. Create the SU.
>>>>>
>>>>> The steps to create the SU are missing. Guesswork again, I jumped
>>>>> around
>>>>> to
>>>>> the Hello World SE tutorial instead. I again assume it is the same for
>>>>> both
>>>>> BC and SE. From now on I am practically on my own jumping from other
>>>>> tutorials and trying to figure things out the hard way:
>>>>>
>>>>>   
>>>>>     
>>>>>         
>>>> --> wow, you are right. I really over-read this fact. It will be added
>>>> soon.
>>>> Basically you can use the archetype "servicemix-service-unit" for the
>>>> SU
>>>> creation in this case.
>>>>
>>>>   
>>>>       
>>>>> I added the following dependency to pom.xml of hello-world-su:
>>>>>
>>>>>     
>>>>>       org.apache.servicemix.samples.helloworld.bc
>>>>>       hello-world-bc
>>>>>       1.0-SNAPSHOT
>>>>>   
>>>>>     
>>>>>         
>>>> --> yes, this is correct if the version of your bc is really
>>>> 1.0-SNAPSHOT
>>>>
>>>>   
>>>>       
>>>>>     
>>>>>
>>>>> I added a new xbean.xml file under the resources folder of
>>>>> hello-world-su:
>>>>>
>>>>>   
>>>>>     
>>>>>         
>>>> --> also done correctly. I suppose you used the servicemix-service-unit
>>>> archetype which doesn't provide an own xbean.xml. But you may copy
>>>> almost any other xbean...for example the xbean of the file-poller or
>>>> something similar. Be sure to adapt the xbean file correctly as it uses
>>>> some annotations of the endpoint classes.
>>>> In this case the endpoint should be defined:
>>>>
>>>> <component:provider ......
>>>>
>>>> or
>>>>
>>>> <component:consumer ......
>>>>
>>>> The component comes from the
>>>>
>>>> /**
>>>>  * @org.apache.xbean.XBean element="component"
>>>>  */
>>>> public class MyComponent extends DefaultComponent {
>>>>
>>>> --> see the annotation, it will be used.
>>>>
>>>>
>>>> for provider or consumer see the corresponding classes
>>>> MyConsumerEndpoint and MyProviderEndpoint...it's same there.
>>>>
>>>> Also have a look at your BC's pom.xml file. There is a important
>>>> section
>>>> to get your namespace for the SU:
>>>>
>>>>     ....
>>>>      <plugin>
>>>>         <groupId>org.apache.xbean</groupId>
>>>>         <artifactId>maven-xbean-plugin</artifactId>
>>>>         <version>${xbean-version}</version>
>>>>         <executions>
>>>>           <execution>
>>>>             <configuration>
>>>>
>>>> --> see here the namespace, adapt it if you need to:
>>>>               <namespace>http://${packageName}/1.0</namespace>
>>>>
>>>>             </configuration>
>>>>             <goals>
>>>>               <goal>mapping</goal>
>>>>             </goals>
>>>>           </execution>
>>>>         </executions>
>>>>       </plugin>
>>>>     ....
>>>>
>>>> This namespace will be used in your SU's xbean.xml. Just replace the
>>>> part after the xmlns:something="..." with your namespace set in the
>>>> BC's
>>>> pom.
>>>>
>>>> <?xml version="1.0"?>
>>>> <beans xmlns:something="someuri">
>>>>       <component:consumer ....
>>>>   
>>>>       
>>>>>   
>>>>>
>>>>>
>>>>> Again even the Hello World SE tutorial has lots of explanations
>>>>> missing.
>>>>>
>>>>> I assume I am done with the SU and try mvn install in its directory.
>>>>>
>>>>>
>>>>> 9. Create the SA
>>>>>
>>>>> Back to the original Hello World BC tutorial again.
>>>>> Created the SA through Maven OK. 
>>>>>
>>>>> In the tutorial there is the following confusing statement:
>>>>>
>>>>> The hello-world-smx directory should now contain the following two
>>>>> directories: 
>>>>> $ ls 
>>>>> hello-world-sa hello-world-bc
>>>>> If the SU is needed, where is its directory??
>>>>>   
>>>>>     
>>>>>         
>>>> --> it seems the author saw that the SU creation isn't in the wiki so
>>>> he
>>>> skipped it here as well. of course the SU directory is missing here.
>>>>
>>>>
>>>>   
>>>>       
>>>>> The tutorial proceeds with stating that the following needs to be
>>>>> added
>>>>> to
>>>>> the SA pom.xml:
>>>>>
>>>>>     
>>>>>       org.apache.servicemix.samples.helloworld.bc
>>>>>       hello-world-bc
>>>>>       1.0-SNAPSHOT
>>>>>     
>>>>>
>>>>> What about the SU??
>>>>>   
>>>>>     
>>>>>         
>>>> Imho this also makes no sense to me, but maybe there are existing other
>>>> deployment methods which make it possible.
>>>> The SA should only have the SU as dependency. The BC is a dependency of
>>>> the SU.
>>>>
>>>>   
>>>>       
>>>>> I proceed blindly with mvn install within the SA directory.
>>>>>
>>>>> 10. The top level project
>>>>>
>>>>> The tutorial states: Now that we have created the SU and SA projects a
>>>>> top
>>>>> level pom.xml must be manually created and made aware of each
>>>>> subproject.
>>>>> pom.xml needs to be edited to include each subproject.
>>>>>
>>>>>   
>>>>>     
>>>>>         
>>>> --> there is an open JIRA for having such a super pom archetype. Until
>>>> it is solved you have to do it manually.
>>>>
>>>> The pom should look like this:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <project xmlns="http://maven.apache.org/POM/4.0.0" 
>>>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>>>> http://maven.apache.org/maven-v4_0_0.xsd">
>>>>
>>>>   <modelVersion>4.0.0</modelVersion>
>>>>
>>>>   <groupId>org.apache.servicemix.samples.helloworld</groupId>
>>>>   <artifactId>hello-world-smx</artifactId>
>>>>   <packaging>pom</packaging>
>>>>   <version>1.0-SNAPSHOT</version>
>>>>   <name>Hello World JBI Component</name>
>>>>
>>>>   <modules>
>>>>     <module>hello-world-bc</module>
>>>>     <module>hello-world-su</module>
>>>>     <module>hello-world-sa</module>
>>>>   </modules>
>>>>
>>>> </project>
>>>>
>>>>
>>>> Remember this is only a build tool's instruction file. It has nothing
>>>> to
>>>> do with smx at this moment. It builds the BC first, then the SU and
>>>> finally the SA so all the internal dependencies are fine.
>>>>
>>>>
>>>>   
>>>>       
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>
>>>>>
>>>>>   4.0.0
>>>>>
>>>>>   org.apache.servicemix.samples.helloworld
>>>>>   hello-world-smx
>>>>>   pom
>>>>>   1.0-SNAPSHOT
>>>>>   Hello World JBI Component
>>>>>
>>>>>   
>>>>>     hello-world-sa
>>>>>     hello-world-bc
>>>>>   
>>>>>
>>>>>
>>>>>
>>>>> Again, where is the SU?
>>>>>
>>>>> The tutorial proceeds further stating that an ls should list the
>>>>> following
>>>>> files.
>>>>>
>>>>> $ ls 
>>>>> hello-world-sa hello-world-bc pom.xml
>>>>>   
>>>>>     
>>>>>         
>>>> no, it better should be:
>>>>
>>>> $ ls 
>>>> hello-world-bc hello-world-sa hello-world-su pom.xml
>>>>
>>>>
>>>>
>>>>   
>>>>       
>>>>> If the SU is needed, where is it going to be included?
>>>>>
>>>>>
>>>>> 11. Give Each of the Maven Subprojects a Name
>>>>> 12. mvn clean install of the root folder 
>>>>>
>>>>> 13. Deploying the Component 
>>>>>
>>>>> Now that the SA is built, we're ready to deploy it to the JBI
>>>>> container. 
>>>>> This is a work in progress. I will finish this up very soon.
>>>>>
>>>>> Again missing information.
>>>>>
>>>>> I just copied hello-world-sa-1.0-SNAPSHOT.jar.
>>>>>   
>>>>>     
>>>>>         
>>>> You have to copy the BC and the SA zip files to the hotdeploy folder.
>>>>
>>>>
>>>>
>>>>   
>>>>       
>>>>> At this point I am really looking forward to test the component out,
>>>>> so
>>>>> I
>>>>> just modified MySpringComponentTest to use the RemoteServiceMixClient
>>>>> in
>>>>> this way:
>>>>>
>>>>> RemoteServiceMixClient rc = new 
>>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>>
>>>>> I am shooting blindly at this point since I am not sure what the QName
>>>>> URN
>>>>> should be etc., but assuming that it worked before on the
>>>>> DefaultServiceMixClient I try it out just the same.
>>>>>
>>>>> I get the following error:
>>>>>
>>>>> 3253 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>>> ServiceName
>>>>> ({urn:test}service) specified for routing, but can't find it
>>>>> registered
>>>>> ...
>>>>> javax.jbi.messaging.MessagingException: Could not find route for
>>>>> exchange:
>>>>> InOut[
>>>>>   id: ID:10.0.0.1-1191902c607-3:0
>>>>>   status: Active
>>>>>   role: provider
>>>>>   service: {urn:test}service
>>>>>   in: <?xml version="1.0" encoding="UTF-8"?>world
>>>>> ] for service: {urn:test}service and interface: null
>>>>> 	at
>>>>> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
>>>>> 	at
>>>>> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
>>>>> ...
>>>>>
>>>>>   
>>>>>     
>>>>>         
>>>> --> the endpoint uri was wrong. See my above comments about the
>>>> namespace thing.
>>>>
>>>>   
>>>>       
>>>>> With all the assumptions and guesswork I had to do, this tutorial is
>>>>> definitely NOT straightforward. I would appreciate if someone could
>>>>> correct
>>>>> me where I did a wrong step and tell me what I have to do to
>>>>> eventually
>>>>> test
>>>>> the component with RemoteServiceMixClient.
>>>>>
>>>>>   
>>>>>     
>>>>>         
>>>> --> you are right. it really needs a rework.
>>>>
>>>> Regards
>>>> Lars
>>>>
>>>>
>>>>   
>>>>       
>>>>> Thanks.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> lhe77 wrote:
>>>>>   
>>>>>     
>>>>>         
>>>>>> Yes, the service unit is needed because it configures the BC.
>>>>>> I had a look at the Hello World BC wiki page and it looks not that
>>>>>> bad
>>>>>> as you described it.
>>>>>>
>>>>>> Maybe you did not really understand how BC/SE, SU and SA plays
>>>>>> together.
>>>>>> BC and SE are engines, which are deployed to the smx. But when doing
>>>>>> it,
>>>>>> it does not
>>>>>> mean that you have then a working Hello World example. For doing such
>>>>>> example you have to deploy a Hello World ServiceUnit which configures
>>>>>> an
>>>>>> endpoint using the BC in a ServiceAssembly.
>>>>>>
>>>>>> Please re-read the whole wiki page and don't skip out things. If you
>>>>>> still have problems please describe what you already did and what's
>>>>>> the
>>>>>> problem exactly.
>>>>>>
>>>>>> Regards
>>>>>> Lars
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> jbx schrieb:
>>>>>>     
>>>>>>       
>>>>>>           
>>>>>>> Hi all,
>>>>>>>
>>>>>>> First of all I am a newbie, so please ignore my ignorance if my
>>>>>>> question
>>>>>>> is
>>>>>>> obvious.
>>>>>>>
>>>>>>> I have tried to follow the HelloWorld-BC tutorial but it is quite
>>>>>>> incomplete, so I hope to close the gaps here. I tried to look around
>>>>>>> and
>>>>>>> lots of people seemed to have problems too but there are no clear
>>>>>>> answers
>>>>>>> to
>>>>>>> my questions.
>>>>>>>
>>>>>>> 1. Is the Service Unit needed? If yes can I follow some other
>>>>>>> tutorial
>>>>>>> to
>>>>>>> get it done? I tried to follow the steps from other tutorials, but
>>>>>>> not
>>>>>>> sure
>>>>>>> if I omitted something. In the Hello-World-BC tutorial there is just
>>>>>>> this:
>>>>>>>
>>>>>>> == 1. Creating a Hello World BC Service Unit 
>>>>>>> This is a work in progress 
>>>>>>>
>>>>>>> 2. What are the steps to deploy the BC into the actual ServiceMix?
>>>>>>> Same
>>>>>>> problem with the documentation:
>>>>>>>
>>>>>>> == Deploying the Component 
>>>>>>> Now that the SA is built, we're ready to deploy it to the JBI
>>>>>>> container. 
>>>>>>>
>>>>>>> This is a work in progress. I will finish this up very soon
>>>>>>>
>>>>>>> I tried to reason things out and got to a point where I finally got
>>>>>>> ServiceMix to load my hello-world-sa (created the missing
>>>>>>> MyBootstrap.java
>>>>>>> etc.) However I must have missed something.
>>>>>>>
>>>>>>> I modified the MySpringComponentTest to use the
>>>>>>> RemoteServiceMixClient
>>>>>>> instead to access the ServiceMix JVM:
>>>>>>>
>>>>>>> RemoteServiceMixClient rc = new 
>>>>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>>>>
>>>>>>>  but I just got this error:
>>>>>>>
>>>>>>> 4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>>>>> ServiceName
>>>>>>> ({urn:test}service) specified for routing, but can't find it
>>>>>>> registered
>>>>>>>
>>>>>>>
>>>>>>> I suspect that this is something related to endpoints and the way
>>>>>>> the
>>>>>>> BC
>>>>>>> was
>>>>>>> deployed, but I have no idea what to do next.
>>>>>>>
>>>>>>> In the end I just want to learn how to develop my own BC for a
>>>>>>> specific
>>>>>>> protocol and have it accessible on the [ServiceMix] ESB from other
>>>>>>> clients
>>>>>>> remotely.
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>         
>>>>>>>             
>>>>>>     
>>>>>>       
>>>>>>           
>>>>>   
>>>>>     
>>>>>         
>>>>   
>>>>       
>>>     
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16537210.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: HelloWorld BC

Posted by Lars Heinemann <la...@compart.net>.
Ok, I will give you a quick example:

I developed for example a servicemix-mail binding component.
There are 2 kind of endpoint types known by the mail component...
The poller will serve as the example:

/**
 * This is the polling endpoint for the mail component.
 *
 * @org.apache.xbean.XBean element="poller"
 * @author lhein
 */
public class MailPollerEndpoint extends PollingEndpoint implements
MailEndpointType {
....
}

See the annotation element = "poller". This defines how the endpoint is
refered to from inside your SU's xbean.xml.
It looks like this:

<?xml version="1.0"?>
<beans xmlns:mail="http://servicemix.apache.org/mail/1.0"
    xmlns:cp="http://www.compart.net/ns/jbi">

    <mail:poller service="cp:email" endpoint="emailPollEndpoint"
                 targetService="cp:inputRouter"
                 targetOperation="cp:process"
                 period="10000"
                 debugMode="false"
                 connection="imaps://me@myserver/INBOX?password=pass"
                 deleteProcessedMessages="false"
                 processOnlyUnseenMessages="true" />
    </mail:poller>
</beans>

You can see here the
    <mail:poller ...
where you find the term "poller" again. It means you refer to the
MailPollerEndpoint.java class.

Where does the <mail: comes from? Look at the pom.xml of the
servicemix-mail binding component.
You will find a section like this:

     <plugin>
        <groupId>org.apache.xbean</groupId>
        <artifactId>maven-xbean-plugin</artifactId>
        <version>${xbean-version}</version>
        <executions>
          <execution>
            <goals>
              <goal>mapping</goal>
            </goals>
            <configuration>
              <namespace>http://servicemix.apache.org/mail/1.0</namespace>
            </configuration>
          </execution>
        </executions>
      </plugin>

Look at the namespace tag. And now look at the xbean.xml above and you
will find exactly this namespace defined to be the mail namespace:

<beans xmlns:mail="http://servicemix.apache.org/mail/1.0" ...

I hope this clarifies the usage a little. If you have further problems,
just let us know.

Regards
Lars



jbx schrieb:
> Hi Lars,
>
> I noticed that the Hello World BC has been updated with a long list of TODOs
> :)
>
> I am still struggling to get the xbean.xml configured correctly (hopefully I
> manage today by syndicating some other tutorials and documentation around
> combined with guesswork). I didnt quite understand your <component:...> part
> and dont know what to add in my xbean yet. I strongly suggest that in the
> tutorial the full working xbean.xml for the SU is put.
>
> I tried to go to jconsole but (I suppose because of the xbean problem) the
> HelloWorld endpoint is missing from the list of endpoints under
> ServiceMix->Endpoint.
>
> I also tried to follow the namespace (from the BC) but
> http://org.apache.servicemix.samples.helloworld.bc/1.0 does not exist so not
> even my IDE can auto-complete the tags.
>
> If you are developing your own BC, how do you create your namespace? I dont
> think it should be referring to servicemix.samples.helloworld.bc right?
>
> Thanks again.
>
>
>
>
> lhe77 wrote:
>   
>> For your testing error:
>>
>> Open up a jconsole and connect to your running smx instance.
>> Then browse to:
>>
>> org.apache.servicemix > ServiceMix > Endpoint
>>
>> There watch out for your helloWorld endpoint.
>> Select and expand the item to External and select the
>> Attributes node.
>>
>> Now you can see the serviceName of the endpoint in the list to the right.
>> This is the uri to send the test messages to I think.
>>
>> Just to show you also the JMX opportunities of the smx. :)
>>
>> Regards
>> Lars
>>
>>
>>
>> Lars Heinemann schrieb:
>>     
>>> I think now I better understand your point of view.
>>> The tutorial really lacks some important information and is also
>>> plain wrong in some descriptions. I will update this tutorial asap.
>>>
>>> For the meanwhile...see my comments inside your mail:
>>>
>>>
>>> jbx schrieb:
>>>   
>>>       
>>>> Hi Lars, 
>>>>
>>>> The fact that you have to skip from one tutorial to another trying to
>>>> 'infer' how things should be done (apart from the fact that the latest
>>>> Maven
>>>> and its Archetypes do not match the tutorial) simply confuses newbies
>>>> and
>>>> creates immense frustration instead of appreciation of the strength of
>>>> the
>>>> technology they're trying to learn. 
>>>>
>>>> How should someone who has just heard about a Service Unit suddenly
>>>> become
>>>> an expert and 'know' how to do the SU for a BC if it is not in the
>>>> tutorial?
>>>>
>>>> Just to verify that I am not missing anything out I have done everything
>>>> from scratch again, sorry if its long:
>>>>
>>>> 1. Created directory hello-world-smx and changed the working directory
>>>> to
>>>> it.
>>>> 2. Created the servicemix-binding-component archetype from maven
>>>>  
>>>> Problem: This does not work:
>>>>
>>>> mvn archetype:create \ 
>>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>>> -DarchetypeArtifactId=servicemix-binding-component \
>>>> -DarchetypeVersion=3.2.1 \
>>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>>> -DartifactId=hello-world-bc 
>>>>
>>>> To follow the tutorial in the same way it has to be:
>>>> mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \ 
>>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>>> -DarchetypeArtifactId=servicemix-binding-component \
>>>> -DarchetypeVersion=3.2.1 \
>>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>>> -DartifactId=hello-world-bc 
>>>>
>>>> It worked for the Getting Started tutorials, so I guess nothing wrong
>>>> with
>>>> the above.
>>>>   
>>>>     
>>>>         
>>> --> This is a known issue for which even a JIRA exists. The solution you
>>> choose was correct.
>>>       I will put a hint to the section in the tutorial.
>>>
>>>
>>>
>>>   
>>>       
>>>> 3. mvn install worked.
>>>> 4. created the respective IDE project file: mvn idea:idea
>>>> 5. modified MyProviderEndpoint.processInOut() accordingly
>>>> 6. modified MySpringComponentTest accordingly and performed mvn install
>>>>
>>>> When executing MySpringComponentTest it works fine and the
>>>> hello-world-bc
>>>> converts the message.
>>>>
>>>> 7. Deploying the BC to ServiceMix. 
>>>>
>>>> It is not clear if the BC is separate to the SU or the SU is a zip file
>>>> which also contains the BC. In this tutorial it states that mvn install
>>>> has
>>>> created an install zip file which can be deployed into servicemix, but
>>>> this
>>>> does not complete the deployment of the BC since it needs an SU. 
>>>>   
>>>>     
>>>>         
>>> --> imho the BC should be deployed standalone as it should a generic
>>> protocol bridge
>>> which may be used by several other service units. The zip file of the bc
>>> is just dropped to the hotdeploy folder of your smx installation and
>>> will be deployed automatically.
>>>
>>>   
>>>       
>>>> From other places on the service-mix site I learnt that an SU is
>>>> essentially
>>>> like a war file. So one thinks, should I create the SU before deploying
>>>> the
>>>> BC into servicemix and deploy 1 zip file (like we do for a webapp) which
>>>> contains the SU which in itself contains the BC. This is quite
>>>> confusing.
>>>>   
>>>>     
>>>>         
>>> --> no, the BC should be the first step to create. when the bc is
>>> deployed you may create a SU and the SA which is in fact only a deploy
>>> format for the SU and the SA's zip will be dropped into the hotdeploy
>>> folder as well. If the dependency settings of your SU are pointing to
>>> your BC then it should even tell you if the BC is not deployed to smx.
>>> You can try it if you remove the BC and try to deploy only the SA. smx
>>> will tell you in the console that it now awaits the deployment of the
>>> hello-world-bc before finishing the deployment of the SA.
>>>
>>>   
>>>       
>>>> I put the BC install file into servicemix /hotdeploy, even though this
>>>> seems
>>>> to contradict the above reasoning, but I guess I misunderstood something
>>>> here.
>>>>
>>>> Problem:
>>>>
>>>> ERROR - InstallerMBeanImpl             - Class not found:
>>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>>> java.lang.ClassNotFoundException:
>>>> org.apache.servicemix.samples.helloworld.bc.My
>>>> Bootstrap in classloader
>>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>>>         at
>>>> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
>>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>>>         at
>>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.createBootstrap(InstallerMBeanImpl.java:120)
>>>>         at
>>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.(InstallerMBeanImpl.java:68)
>>>>         at
>>>> org.apache.servicemix.jbi.framework.InstallationService.initializeInstaller(InstallationService.java:447)
>>>>         at
>>>> org.apache.servicemix.jbi.framework.InstallationService.doInstallComp
>>>> onent(InstallationService.java:429)
>>>>         ...
>>>>
>>>> The only reference to Bootstrap in the tutorial is struck out, as if it
>>>> is
>>>> deprecated, but obviously it is not so. After some reasoning out I
>>>> created a
>>>> new MyBootstrap class which implements Bootstrap and implements its
>>>> methods.
>>>> Ran again mvn install and tried to deploy it again and it worked (I
>>>> think).
>>>>
>>>>   
>>>>     
>>>>         
>>> --> now as you are telling me this I can remember I had the same
>>> problems and I did solve them by adding my own bootstrap class. You did
>>> it correctly I think. Maybe gnodet or some other dev can tell you why
>>> the archetype for the BC isn't working as it should.
>>>
>>>   
>>>       
>>>> 8. Create the SU.
>>>>
>>>> The steps to create the SU are missing. Guesswork again, I jumped around
>>>> to
>>>> the Hello World SE tutorial instead. I again assume it is the same for
>>>> both
>>>> BC and SE. From now on I am practically on my own jumping from other
>>>> tutorials and trying to figure things out the hard way:
>>>>
>>>>   
>>>>     
>>>>         
>>> --> wow, you are right. I really over-read this fact. It will be added
>>> soon.
>>> Basically you can use the archetype "servicemix-service-unit" for the SU
>>> creation in this case.
>>>
>>>   
>>>       
>>>> I added the following dependency to pom.xml of hello-world-su:
>>>>
>>>>     
>>>>       org.apache.servicemix.samples.helloworld.bc
>>>>       hello-world-bc
>>>>       1.0-SNAPSHOT
>>>>   
>>>>     
>>>>         
>>> --> yes, this is correct if the version of your bc is really 1.0-SNAPSHOT
>>>
>>>   
>>>       
>>>>     
>>>>
>>>> I added a new xbean.xml file under the resources folder of
>>>> hello-world-su:
>>>>
>>>>   
>>>>     
>>>>         
>>> --> also done correctly. I suppose you used the servicemix-service-unit
>>> archetype which doesn't provide an own xbean.xml. But you may copy
>>> almost any other xbean...for example the xbean of the file-poller or
>>> something similar. Be sure to adapt the xbean file correctly as it uses
>>> some annotations of the endpoint classes.
>>> In this case the endpoint should be defined:
>>>
>>> <component:provider ......
>>>
>>> or
>>>
>>> <component:consumer ......
>>>
>>> The component comes from the
>>>
>>> /**
>>>  * @org.apache.xbean.XBean element="component"
>>>  */
>>> public class MyComponent extends DefaultComponent {
>>>
>>> --> see the annotation, it will be used.
>>>
>>>
>>> for provider or consumer see the corresponding classes
>>> MyConsumerEndpoint and MyProviderEndpoint...it's same there.
>>>
>>> Also have a look at your BC's pom.xml file. There is a important section
>>> to get your namespace for the SU:
>>>
>>>     ....
>>>      <plugin>
>>>         <groupId>org.apache.xbean</groupId>
>>>         <artifactId>maven-xbean-plugin</artifactId>
>>>         <version>${xbean-version}</version>
>>>         <executions>
>>>           <execution>
>>>             <configuration>
>>>
>>> --> see here the namespace, adapt it if you need to:
>>>               <namespace>http://${packageName}/1.0</namespace>
>>>
>>>             </configuration>
>>>             <goals>
>>>               <goal>mapping</goal>
>>>             </goals>
>>>           </execution>
>>>         </executions>
>>>       </plugin>
>>>     ....
>>>
>>> This namespace will be used in your SU's xbean.xml. Just replace the
>>> part after the xmlns:something="..." with your namespace set in the BC's
>>> pom.
>>>
>>> <?xml version="1.0"?>
>>> <beans xmlns:something="someuri">
>>>       <component:consumer ....
>>>   
>>>       
>>>>   
>>>>
>>>>
>>>> Again even the Hello World SE tutorial has lots of explanations missing.
>>>>
>>>> I assume I am done with the SU and try mvn install in its directory.
>>>>
>>>>
>>>> 9. Create the SA
>>>>
>>>> Back to the original Hello World BC tutorial again.
>>>> Created the SA through Maven OK. 
>>>>
>>>> In the tutorial there is the following confusing statement:
>>>>
>>>> The hello-world-smx directory should now contain the following two
>>>> directories: 
>>>> $ ls 
>>>> hello-world-sa hello-world-bc
>>>> If the SU is needed, where is its directory??
>>>>   
>>>>     
>>>>         
>>> --> it seems the author saw that the SU creation isn't in the wiki so he
>>> skipped it here as well. of course the SU directory is missing here.
>>>
>>>
>>>   
>>>       
>>>> The tutorial proceeds with stating that the following needs to be added
>>>> to
>>>> the SA pom.xml:
>>>>
>>>>     
>>>>       org.apache.servicemix.samples.helloworld.bc
>>>>       hello-world-bc
>>>>       1.0-SNAPSHOT
>>>>     
>>>>
>>>> What about the SU??
>>>>   
>>>>     
>>>>         
>>> Imho this also makes no sense to me, but maybe there are existing other
>>> deployment methods which make it possible.
>>> The SA should only have the SU as dependency. The BC is a dependency of
>>> the SU.
>>>
>>>   
>>>       
>>>> I proceed blindly with mvn install within the SA directory.
>>>>
>>>> 10. The top level project
>>>>
>>>> The tutorial states: Now that we have created the SU and SA projects a
>>>> top
>>>> level pom.xml must be manually created and made aware of each
>>>> subproject.
>>>> pom.xml needs to be edited to include each subproject.
>>>>
>>>>   
>>>>     
>>>>         
>>> --> there is an open JIRA for having such a super pom archetype. Until
>>> it is solved you have to do it manually.
>>>
>>> The pom should look like this:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <project xmlns="http://maven.apache.org/POM/4.0.0" 
>>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>>> http://maven.apache.org/maven-v4_0_0.xsd">
>>>
>>>   <modelVersion>4.0.0</modelVersion>
>>>
>>>   <groupId>org.apache.servicemix.samples.helloworld</groupId>
>>>   <artifactId>hello-world-smx</artifactId>
>>>   <packaging>pom</packaging>
>>>   <version>1.0-SNAPSHOT</version>
>>>   <name>Hello World JBI Component</name>
>>>
>>>   <modules>
>>>     <module>hello-world-bc</module>
>>>     <module>hello-world-su</module>
>>>     <module>hello-world-sa</module>
>>>   </modules>
>>>
>>> </project>
>>>
>>>
>>> Remember this is only a build tool's instruction file. It has nothing to
>>> do with smx at this moment. It builds the BC first, then the SU and
>>> finally the SA so all the internal dependencies are fine.
>>>
>>>
>>>   
>>>       
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>
>>>>
>>>>   4.0.0
>>>>
>>>>   org.apache.servicemix.samples.helloworld
>>>>   hello-world-smx
>>>>   pom
>>>>   1.0-SNAPSHOT
>>>>   Hello World JBI Component
>>>>
>>>>   
>>>>     hello-world-sa
>>>>     hello-world-bc
>>>>   
>>>>
>>>>
>>>>
>>>> Again, where is the SU?
>>>>
>>>> The tutorial proceeds further stating that an ls should list the
>>>> following
>>>> files.
>>>>
>>>> $ ls 
>>>> hello-world-sa hello-world-bc pom.xml
>>>>   
>>>>     
>>>>         
>>> no, it better should be:
>>>
>>> $ ls 
>>> hello-world-bc hello-world-sa hello-world-su pom.xml
>>>
>>>
>>>
>>>   
>>>       
>>>> If the SU is needed, where is it going to be included?
>>>>
>>>>
>>>> 11. Give Each of the Maven Subprojects a Name
>>>> 12. mvn clean install of the root folder 
>>>>
>>>> 13. Deploying the Component 
>>>>
>>>> Now that the SA is built, we're ready to deploy it to the JBI container. 
>>>> This is a work in progress. I will finish this up very soon.
>>>>
>>>> Again missing information.
>>>>
>>>> I just copied hello-world-sa-1.0-SNAPSHOT.jar.
>>>>   
>>>>     
>>>>         
>>> You have to copy the BC and the SA zip files to the hotdeploy folder.
>>>
>>>
>>>
>>>   
>>>       
>>>> At this point I am really looking forward to test the component out, so
>>>> I
>>>> just modified MySpringComponentTest to use the RemoteServiceMixClient in
>>>> this way:
>>>>
>>>> RemoteServiceMixClient rc = new 
>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>
>>>> I am shooting blindly at this point since I am not sure what the QName
>>>> URN
>>>> should be etc., but assuming that it worked before on the
>>>> DefaultServiceMixClient I try it out just the same.
>>>>
>>>> I get the following error:
>>>>
>>>> 3253 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>> ServiceName
>>>> ({urn:test}service) specified for routing, but can't find it registered
>>>> ...
>>>> javax.jbi.messaging.MessagingException: Could not find route for
>>>> exchange:
>>>> InOut[
>>>>   id: ID:10.0.0.1-1191902c607-3:0
>>>>   status: Active
>>>>   role: provider
>>>>   service: {urn:test}service
>>>>   in: <?xml version="1.0" encoding="UTF-8"?>world
>>>> ] for service: {urn:test}service and interface: null
>>>> 	at
>>>> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
>>>> 	at
>>>> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
>>>> ...
>>>>
>>>>   
>>>>     
>>>>         
>>> --> the endpoint uri was wrong. See my above comments about the
>>> namespace thing.
>>>
>>>   
>>>       
>>>> With all the assumptions and guesswork I had to do, this tutorial is
>>>> definitely NOT straightforward. I would appreciate if someone could
>>>> correct
>>>> me where I did a wrong step and tell me what I have to do to eventually
>>>> test
>>>> the component with RemoteServiceMixClient.
>>>>
>>>>   
>>>>     
>>>>         
>>> --> you are right. it really needs a rework.
>>>
>>> Regards
>>> Lars
>>>
>>>
>>>   
>>>       
>>>> Thanks.
>>>>
>>>>
>>>>
>>>>
>>>> lhe77 wrote:
>>>>   
>>>>     
>>>>         
>>>>> Yes, the service unit is needed because it configures the BC.
>>>>> I had a look at the Hello World BC wiki page and it looks not that bad
>>>>> as you described it.
>>>>>
>>>>> Maybe you did not really understand how BC/SE, SU and SA plays
>>>>> together.
>>>>> BC and SE are engines, which are deployed to the smx. But when doing
>>>>> it,
>>>>> it does not
>>>>> mean that you have then a working Hello World example. For doing such
>>>>> example you have to deploy a Hello World ServiceUnit which configures
>>>>> an
>>>>> endpoint using the BC in a ServiceAssembly.
>>>>>
>>>>> Please re-read the whole wiki page and don't skip out things. If you
>>>>> still have problems please describe what you already did and what's the
>>>>> problem exactly.
>>>>>
>>>>> Regards
>>>>> Lars
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> jbx schrieb:
>>>>>     
>>>>>       
>>>>>           
>>>>>> Hi all,
>>>>>>
>>>>>> First of all I am a newbie, so please ignore my ignorance if my
>>>>>> question
>>>>>> is
>>>>>> obvious.
>>>>>>
>>>>>> I have tried to follow the HelloWorld-BC tutorial but it is quite
>>>>>> incomplete, so I hope to close the gaps here. I tried to look around
>>>>>> and
>>>>>> lots of people seemed to have problems too but there are no clear
>>>>>> answers
>>>>>> to
>>>>>> my questions.
>>>>>>
>>>>>> 1. Is the Service Unit needed? If yes can I follow some other tutorial
>>>>>> to
>>>>>> get it done? I tried to follow the steps from other tutorials, but not
>>>>>> sure
>>>>>> if I omitted something. In the Hello-World-BC tutorial there is just
>>>>>> this:
>>>>>>
>>>>>> == 1. Creating a Hello World BC Service Unit 
>>>>>> This is a work in progress 
>>>>>>
>>>>>> 2. What are the steps to deploy the BC into the actual ServiceMix?
>>>>>> Same
>>>>>> problem with the documentation:
>>>>>>
>>>>>> == Deploying the Component 
>>>>>> Now that the SA is built, we're ready to deploy it to the JBI
>>>>>> container. 
>>>>>>
>>>>>> This is a work in progress. I will finish this up very soon
>>>>>>
>>>>>> I tried to reason things out and got to a point where I finally got
>>>>>> ServiceMix to load my hello-world-sa (created the missing
>>>>>> MyBootstrap.java
>>>>>> etc.) However I must have missed something.
>>>>>>
>>>>>> I modified the MySpringComponentTest to use the RemoteServiceMixClient
>>>>>> instead to access the ServiceMix JVM:
>>>>>>
>>>>>> RemoteServiceMixClient rc = new 
>>>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>>>
>>>>>>  but I just got this error:
>>>>>>
>>>>>> 4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>>>> ServiceName
>>>>>> ({urn:test}service) specified for routing, but can't find it
>>>>>> registered
>>>>>>
>>>>>>
>>>>>> I suspect that this is something related to endpoints and the way the
>>>>>> BC
>>>>>> was
>>>>>> deployed, but I have no idea what to do next.
>>>>>>
>>>>>> In the end I just want to learn how to develop my own BC for a
>>>>>> specific
>>>>>> protocol and have it accessible on the [ServiceMix] ESB from other
>>>>>> clients
>>>>>> remotely.
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>         
>>>>>>             
>>>>>     
>>>>>       
>>>>>           
>>>>   
>>>>     
>>>>         
>>>   
>>>       
>>     
>
>   

Re: HelloWorld BC

Posted by jbx <jo...@gmail.com>.
Hi Lars,

I noticed that the Hello World BC has been updated with a long list of TODOs
:)

I am still struggling to get the xbean.xml configured correctly (hopefully I
manage today by syndicating some other tutorials and documentation around
combined with guesswork). I didnt quite understand your <component:...> part
and dont know what to add in my xbean yet. I strongly suggest that in the
tutorial the full working xbean.xml for the SU is put.

I tried to go to jconsole but (I suppose because of the xbean problem) the
HelloWorld endpoint is missing from the list of endpoints under
ServiceMix->Endpoint.

I also tried to follow the namespace (from the BC) but
http://org.apache.servicemix.samples.helloworld.bc/1.0 does not exist so not
even my IDE can auto-complete the tags.

If you are developing your own BC, how do you create your namespace? I dont
think it should be referring to servicemix.samples.helloworld.bc right?

Thanks again.




lhe77 wrote:
> 
> For your testing error:
> 
> Open up a jconsole and connect to your running smx instance.
> Then browse to:
> 
> org.apache.servicemix > ServiceMix > Endpoint
> 
> There watch out for your helloWorld endpoint.
> Select and expand the item to External and select the
> Attributes node.
> 
> Now you can see the serviceName of the endpoint in the list to the right.
> This is the uri to send the test messages to I think.
> 
> Just to show you also the JMX opportunities of the smx. :)
> 
> Regards
> Lars
> 
> 
> 
> Lars Heinemann schrieb:
>> I think now I better understand your point of view.
>> The tutorial really lacks some important information and is also
>> plain wrong in some descriptions. I will update this tutorial asap.
>>
>> For the meanwhile...see my comments inside your mail:
>>
>>
>> jbx schrieb:
>>   
>>> Hi Lars, 
>>>
>>> The fact that you have to skip from one tutorial to another trying to
>>> 'infer' how things should be done (apart from the fact that the latest
>>> Maven
>>> and its Archetypes do not match the tutorial) simply confuses newbies
>>> and
>>> creates immense frustration instead of appreciation of the strength of
>>> the
>>> technology they're trying to learn. 
>>>
>>> How should someone who has just heard about a Service Unit suddenly
>>> become
>>> an expert and 'know' how to do the SU for a BC if it is not in the
>>> tutorial?
>>>
>>> Just to verify that I am not missing anything out I have done everything
>>> from scratch again, sorry if its long:
>>>
>>> 1. Created directory hello-world-smx and changed the working directory
>>> to
>>> it.
>>> 2. Created the servicemix-binding-component archetype from maven
>>>  
>>> Problem: This does not work:
>>>
>>> mvn archetype:create \ 
>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>> -DarchetypeArtifactId=servicemix-binding-component \
>>> -DarchetypeVersion=3.2.1 \
>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>> -DartifactId=hello-world-bc 
>>>
>>> To follow the tutorial in the same way it has to be:
>>> mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \ 
>>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>>> -DarchetypeArtifactId=servicemix-binding-component \
>>> -DarchetypeVersion=3.2.1 \
>>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>>> -DartifactId=hello-world-bc 
>>>
>>> It worked for the Getting Started tutorials, so I guess nothing wrong
>>> with
>>> the above.
>>>   
>>>     
>> --> This is a known issue for which even a JIRA exists. The solution you
>> choose was correct.
>>       I will put a hint to the section in the tutorial.
>>
>>
>>
>>   
>>> 3. mvn install worked.
>>> 4. created the respective IDE project file: mvn idea:idea
>>> 5. modified MyProviderEndpoint.processInOut() accordingly
>>> 6. modified MySpringComponentTest accordingly and performed mvn install
>>>
>>> When executing MySpringComponentTest it works fine and the
>>> hello-world-bc
>>> converts the message.
>>>
>>> 7. Deploying the BC to ServiceMix. 
>>>
>>> It is not clear if the BC is separate to the SU or the SU is a zip file
>>> which also contains the BC. In this tutorial it states that mvn install
>>> has
>>> created an install zip file which can be deployed into servicemix, but
>>> this
>>> does not complete the deployment of the BC since it needs an SU. 
>>>   
>>>     
>> --> imho the BC should be deployed standalone as it should a generic
>> protocol bridge
>> which may be used by several other service units. The zip file of the bc
>> is just dropped to the hotdeploy folder of your smx installation and
>> will be deployed automatically.
>>
>>   
>>> From other places on the service-mix site I learnt that an SU is
>>> essentially
>>> like a war file. So one thinks, should I create the SU before deploying
>>> the
>>> BC into servicemix and deploy 1 zip file (like we do for a webapp) which
>>> contains the SU which in itself contains the BC. This is quite
>>> confusing.
>>>   
>>>     
>> --> no, the BC should be the first step to create. when the bc is
>> deployed you may create a SU and the SA which is in fact only a deploy
>> format for the SU and the SA's zip will be dropped into the hotdeploy
>> folder as well. If the dependency settings of your SU are pointing to
>> your BC then it should even tell you if the BC is not deployed to smx.
>> You can try it if you remove the BC and try to deploy only the SA. smx
>> will tell you in the console that it now awaits the deployment of the
>> hello-world-bc before finishing the deployment of the SA.
>>
>>   
>>> I put the BC install file into servicemix /hotdeploy, even though this
>>> seems
>>> to contradict the above reasoning, but I guess I misunderstood something
>>> here.
>>>
>>> Problem:
>>>
>>> ERROR - InstallerMBeanImpl             - Class not found:
>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>> java.lang.ClassNotFoundException:
>>> org.apache.servicemix.samples.helloworld.bc.My
>>> Bootstrap in classloader
>>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>>         at
>>> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>>         at
>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.createBootstrap(InstallerMBeanImpl.java:120)
>>>         at
>>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.(InstallerMBeanImpl.java:68)
>>>         at
>>> org.apache.servicemix.jbi.framework.InstallationService.initializeInstaller(InstallationService.java:447)
>>>         at
>>> org.apache.servicemix.jbi.framework.InstallationService.doInstallComp
>>> onent(InstallationService.java:429)
>>>         ...
>>>
>>> The only reference to Bootstrap in the tutorial is struck out, as if it
>>> is
>>> deprecated, but obviously it is not so. After some reasoning out I
>>> created a
>>> new MyBootstrap class which implements Bootstrap and implements its
>>> methods.
>>> Ran again mvn install and tried to deploy it again and it worked (I
>>> think).
>>>
>>>   
>>>     
>> --> now as you are telling me this I can remember I had the same
>> problems and I did solve them by adding my own bootstrap class. You did
>> it correctly I think. Maybe gnodet or some other dev can tell you why
>> the archetype for the BC isn't working as it should.
>>
>>   
>>> 8. Create the SU.
>>>
>>> The steps to create the SU are missing. Guesswork again, I jumped around
>>> to
>>> the Hello World SE tutorial instead. I again assume it is the same for
>>> both
>>> BC and SE. From now on I am practically on my own jumping from other
>>> tutorials and trying to figure things out the hard way:
>>>
>>>   
>>>     
>> --> wow, you are right. I really over-read this fact. It will be added
>> soon.
>> Basically you can use the archetype "servicemix-service-unit" for the SU
>> creation in this case.
>>
>>   
>>> I added the following dependency to pom.xml of hello-world-su:
>>>
>>>     
>>>       org.apache.servicemix.samples.helloworld.bc
>>>       hello-world-bc
>>>       1.0-SNAPSHOT
>>>   
>>>     
>> --> yes, this is correct if the version of your bc is really 1.0-SNAPSHOT
>>
>>   
>>>     
>>>
>>> I added a new xbean.xml file under the resources folder of
>>> hello-world-su:
>>>
>>>   
>>>     
>> --> also done correctly. I suppose you used the servicemix-service-unit
>> archetype which doesn't provide an own xbean.xml. But you may copy
>> almost any other xbean...for example the xbean of the file-poller or
>> something similar. Be sure to adapt the xbean file correctly as it uses
>> some annotations of the endpoint classes.
>> In this case the endpoint should be defined:
>>
>> <component:provider ......
>>
>> or
>>
>> <component:consumer ......
>>
>> The component comes from the
>>
>> /**
>>  * @org.apache.xbean.XBean element="component"
>>  */
>> public class MyComponent extends DefaultComponent {
>>
>> --> see the annotation, it will be used.
>>
>>
>> for provider or consumer see the corresponding classes
>> MyConsumerEndpoint and MyProviderEndpoint...it's same there.
>>
>> Also have a look at your BC's pom.xml file. There is a important section
>> to get your namespace for the SU:
>>
>>     ....
>>      <plugin>
>>         <groupId>org.apache.xbean</groupId>
>>         <artifactId>maven-xbean-plugin</artifactId>
>>         <version>${xbean-version}</version>
>>         <executions>
>>           <execution>
>>             <configuration>
>>
>> --> see here the namespace, adapt it if you need to:
>>               <namespace>http://${packageName}/1.0</namespace>
>>
>>             </configuration>
>>             <goals>
>>               <goal>mapping</goal>
>>             </goals>
>>           </execution>
>>         </executions>
>>       </plugin>
>>     ....
>>
>> This namespace will be used in your SU's xbean.xml. Just replace the
>> part after the xmlns:something="..." with your namespace set in the BC's
>> pom.
>>
>> <?xml version="1.0"?>
>> <beans xmlns:something="someuri">
>>       <component:consumer ....
>>   
>>>   
>>>
>>>
>>> Again even the Hello World SE tutorial has lots of explanations missing.
>>>
>>> I assume I am done with the SU and try mvn install in its directory.
>>>
>>>
>>> 9. Create the SA
>>>
>>> Back to the original Hello World BC tutorial again.
>>> Created the SA through Maven OK. 
>>>
>>> In the tutorial there is the following confusing statement:
>>>
>>> The hello-world-smx directory should now contain the following two
>>> directories: 
>>> $ ls 
>>> hello-world-sa hello-world-bc
>>> If the SU is needed, where is its directory??
>>>   
>>>     
>> --> it seems the author saw that the SU creation isn't in the wiki so he
>> skipped it here as well. of course the SU directory is missing here.
>>
>>
>>   
>>> The tutorial proceeds with stating that the following needs to be added
>>> to
>>> the SA pom.xml:
>>>
>>>     
>>>       org.apache.servicemix.samples.helloworld.bc
>>>       hello-world-bc
>>>       1.0-SNAPSHOT
>>>     
>>>
>>> What about the SU??
>>>   
>>>     
>> Imho this also makes no sense to me, but maybe there are existing other
>> deployment methods which make it possible.
>> The SA should only have the SU as dependency. The BC is a dependency of
>> the SU.
>>
>>   
>>> I proceed blindly with mvn install within the SA directory.
>>>
>>> 10. The top level project
>>>
>>> The tutorial states: Now that we have created the SU and SA projects a
>>> top
>>> level pom.xml must be manually created and made aware of each
>>> subproject.
>>> pom.xml needs to be edited to include each subproject.
>>>
>>>   
>>>     
>> --> there is an open JIRA for having such a super pom archetype. Until
>> it is solved you have to do it manually.
>>
>> The pom should look like this:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <project xmlns="http://maven.apache.org/POM/4.0.0" 
>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>> http://maven.apache.org/maven-v4_0_0.xsd">
>>
>>   <modelVersion>4.0.0</modelVersion>
>>
>>   <groupId>org.apache.servicemix.samples.helloworld</groupId>
>>   <artifactId>hello-world-smx</artifactId>
>>   <packaging>pom</packaging>
>>   <version>1.0-SNAPSHOT</version>
>>   <name>Hello World JBI Component</name>
>>
>>   <modules>
>>     <module>hello-world-bc</module>
>>     <module>hello-world-su</module>
>>     <module>hello-world-sa</module>
>>   </modules>
>>
>> </project>
>>
>>
>> Remember this is only a build tool's instruction file. It has nothing to
>> do with smx at this moment. It builds the BC first, then the SU and
>> finally the SA so all the internal dependencies are fine.
>>
>>
>>   
>>> <?xml version="1.0" encoding="UTF-8"?>
>>>
>>>
>>>   4.0.0
>>>
>>>   org.apache.servicemix.samples.helloworld
>>>   hello-world-smx
>>>   pom
>>>   1.0-SNAPSHOT
>>>   Hello World JBI Component
>>>
>>>   
>>>     hello-world-sa
>>>     hello-world-bc
>>>   
>>>
>>>
>>>
>>> Again, where is the SU?
>>>
>>> The tutorial proceeds further stating that an ls should list the
>>> following
>>> files.
>>>
>>> $ ls 
>>> hello-world-sa hello-world-bc pom.xml
>>>   
>>>     
>> no, it better should be:
>>
>> $ ls 
>> hello-world-bc hello-world-sa hello-world-su pom.xml
>>
>>
>>
>>   
>>> If the SU is needed, where is it going to be included?
>>>
>>>
>>> 11. Give Each of the Maven Subprojects a Name
>>> 12. mvn clean install of the root folder 
>>>
>>> 13. Deploying the Component 
>>>
>>> Now that the SA is built, we're ready to deploy it to the JBI container. 
>>> This is a work in progress. I will finish this up very soon.
>>>
>>> Again missing information.
>>>
>>> I just copied hello-world-sa-1.0-SNAPSHOT.jar.
>>>   
>>>     
>> You have to copy the BC and the SA zip files to the hotdeploy folder.
>>
>>
>>
>>   
>>> At this point I am really looking forward to test the component out, so
>>> I
>>> just modified MySpringComponentTest to use the RemoteServiceMixClient in
>>> this way:
>>>
>>> RemoteServiceMixClient rc = new 
>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>
>>> I am shooting blindly at this point since I am not sure what the QName
>>> URN
>>> should be etc., but assuming that it worked before on the
>>> DefaultServiceMixClient I try it out just the same.
>>>
>>> I get the following error:
>>>
>>> 3253 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>> ServiceName
>>> ({urn:test}service) specified for routing, but can't find it registered
>>> ...
>>> javax.jbi.messaging.MessagingException: Could not find route for
>>> exchange:
>>> InOut[
>>>   id: ID:10.0.0.1-1191902c607-3:0
>>>   status: Active
>>>   role: provider
>>>   service: {urn:test}service
>>>   in: <?xml version="1.0" encoding="UTF-8"?>world
>>> ] for service: {urn:test}service and interface: null
>>> 	at
>>> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
>>> 	at
>>> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
>>> ...
>>>
>>>   
>>>     
>> --> the endpoint uri was wrong. See my above comments about the
>> namespace thing.
>>
>>   
>>> With all the assumptions and guesswork I had to do, this tutorial is
>>> definitely NOT straightforward. I would appreciate if someone could
>>> correct
>>> me where I did a wrong step and tell me what I have to do to eventually
>>> test
>>> the component with RemoteServiceMixClient.
>>>
>>>   
>>>     
>> --> you are right. it really needs a rework.
>>
>> Regards
>> Lars
>>
>>
>>   
>>> Thanks.
>>>
>>>
>>>
>>>
>>> lhe77 wrote:
>>>   
>>>     
>>>> Yes, the service unit is needed because it configures the BC.
>>>> I had a look at the Hello World BC wiki page and it looks not that bad
>>>> as you described it.
>>>>
>>>> Maybe you did not really understand how BC/SE, SU and SA plays
>>>> together.
>>>> BC and SE are engines, which are deployed to the smx. But when doing
>>>> it,
>>>> it does not
>>>> mean that you have then a working Hello World example. For doing such
>>>> example you have to deploy a Hello World ServiceUnit which configures
>>>> an
>>>> endpoint using the BC in a ServiceAssembly.
>>>>
>>>> Please re-read the whole wiki page and don't skip out things. If you
>>>> still have problems please describe what you already did and what's the
>>>> problem exactly.
>>>>
>>>> Regards
>>>> Lars
>>>>
>>>>
>>>>
>>>>
>>>> jbx schrieb:
>>>>     
>>>>       
>>>>> Hi all,
>>>>>
>>>>> First of all I am a newbie, so please ignore my ignorance if my
>>>>> question
>>>>> is
>>>>> obvious.
>>>>>
>>>>> I have tried to follow the HelloWorld-BC tutorial but it is quite
>>>>> incomplete, so I hope to close the gaps here. I tried to look around
>>>>> and
>>>>> lots of people seemed to have problems too but there are no clear
>>>>> answers
>>>>> to
>>>>> my questions.
>>>>>
>>>>> 1. Is the Service Unit needed? If yes can I follow some other tutorial
>>>>> to
>>>>> get it done? I tried to follow the steps from other tutorials, but not
>>>>> sure
>>>>> if I omitted something. In the Hello-World-BC tutorial there is just
>>>>> this:
>>>>>
>>>>> == 1. Creating a Hello World BC Service Unit 
>>>>> This is a work in progress 
>>>>>
>>>>> 2. What are the steps to deploy the BC into the actual ServiceMix?
>>>>> Same
>>>>> problem with the documentation:
>>>>>
>>>>> == Deploying the Component 
>>>>> Now that the SA is built, we're ready to deploy it to the JBI
>>>>> container. 
>>>>>
>>>>> This is a work in progress. I will finish this up very soon
>>>>>
>>>>> I tried to reason things out and got to a point where I finally got
>>>>> ServiceMix to load my hello-world-sa (created the missing
>>>>> MyBootstrap.java
>>>>> etc.) However I must have missed something.
>>>>>
>>>>> I modified the MySpringComponentTest to use the RemoteServiceMixClient
>>>>> instead to access the ServiceMix JVM:
>>>>>
>>>>> RemoteServiceMixClient rc = new 
>>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>>
>>>>>  but I just got this error:
>>>>>
>>>>> 4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>>> ServiceName
>>>>> ({urn:test}service) specified for routing, but can't find it
>>>>> registered
>>>>>
>>>>>
>>>>> I suspect that this is something related to endpoints and the way the
>>>>> BC
>>>>> was
>>>>> deployed, but I have no idea what to do next.
>>>>>
>>>>> In the end I just want to learn how to develop my own BC for a
>>>>> specific
>>>>> protocol and have it accessible on the [ServiceMix] ESB from other
>>>>> clients
>>>>> remotely.
>>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>   
>>>>>       
>>>>>         
>>>>     
>>>>       
>>>   
>>>     
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16535954.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: HelloWorld BC

Posted by Lars Heinemann <la...@compart.net>.
For your testing error:

Open up a jconsole and connect to your running smx instance.
Then browse to:

org.apache.servicemix > ServiceMix > Endpoint

There watch out for your helloWorld endpoint.
Select and expand the item to External and select the
Attributes node.

Now you can see the serviceName of the endpoint in the list to the right.
This is the uri to send the test messages to I think.

Just to show you also the JMX opportunities of the smx. :)

Regards
Lars



Lars Heinemann schrieb:
> I think now I better understand your point of view.
> The tutorial really lacks some important information and is also
> plain wrong in some descriptions. I will update this tutorial asap.
>
> For the meanwhile...see my comments inside your mail:
>
>
> jbx schrieb:
>   
>> Hi Lars, 
>>
>> The fact that you have to skip from one tutorial to another trying to
>> 'infer' how things should be done (apart from the fact that the latest Maven
>> and its Archetypes do not match the tutorial) simply confuses newbies and
>> creates immense frustration instead of appreciation of the strength of the
>> technology they're trying to learn. 
>>
>> How should someone who has just heard about a Service Unit suddenly become
>> an expert and 'know' how to do the SU for a BC if it is not in the tutorial?
>>
>> Just to verify that I am not missing anything out I have done everything
>> from scratch again, sorry if its long:
>>
>> 1. Created directory hello-world-smx and changed the working directory to
>> it.
>> 2. Created the servicemix-binding-component archetype from maven
>>  
>> Problem: This does not work:
>>
>> mvn archetype:create \ 
>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>> -DarchetypeArtifactId=servicemix-binding-component \
>> -DarchetypeVersion=3.2.1 \
>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>> -DartifactId=hello-world-bc 
>>
>> To follow the tutorial in the same way it has to be:
>> mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \ 
>> -DarchetypeGroupId=org.apache.servicemix.tooling \
>> -DarchetypeArtifactId=servicemix-binding-component \
>> -DarchetypeVersion=3.2.1 \
>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
>> -DartifactId=hello-world-bc 
>>
>> It worked for the Getting Started tutorials, so I guess nothing wrong with
>> the above.
>>   
>>     
> --> This is a known issue for which even a JIRA exists. The solution you
> choose was correct.
>       I will put a hint to the section in the tutorial.
>
>
>
>   
>> 3. mvn install worked.
>> 4. created the respective IDE project file: mvn idea:idea
>> 5. modified MyProviderEndpoint.processInOut() accordingly
>> 6. modified MySpringComponentTest accordingly and performed mvn install
>>
>> When executing MySpringComponentTest it works fine and the hello-world-bc
>> converts the message.
>>
>> 7. Deploying the BC to ServiceMix. 
>>
>> It is not clear if the BC is separate to the SU or the SU is a zip file
>> which also contains the BC. In this tutorial it states that mvn install has
>> created an install zip file which can be deployed into servicemix, but this
>> does not complete the deployment of the BC since it needs an SU. 
>>   
>>     
> --> imho the BC should be deployed standalone as it should a generic
> protocol bridge
> which may be used by several other service units. The zip file of the bc
> is just dropped to the hotdeploy folder of your smx installation and
> will be deployed automatically.
>
>   
>> From other places on the service-mix site I learnt that an SU is essentially
>> like a war file. So one thinks, should I create the SU before deploying the
>> BC into servicemix and deploy 1 zip file (like we do for a webapp) which
>> contains the SU which in itself contains the BC. This is quite confusing.
>>   
>>     
> --> no, the BC should be the first step to create. when the bc is
> deployed you may create a SU and the SA which is in fact only a deploy
> format for the SU and the SA's zip will be dropped into the hotdeploy
> folder as well. If the dependency settings of your SU are pointing to
> your BC then it should even tell you if the BC is not deployed to smx.
> You can try it if you remove the BC and try to deploy only the SA. smx
> will tell you in the console that it now awaits the deployment of the
> hello-world-bc before finishing the deployment of the SA.
>
>   
>> I put the BC install file into servicemix /hotdeploy, even though this seems
>> to contradict the above reasoning, but I guess I misunderstood something
>> here.
>>
>> Problem:
>>
>> ERROR - InstallerMBeanImpl             - Class not found:
>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>> java.lang.ClassNotFoundException:
>> org.apache.servicemix.samples.helloworld.bc.My
>> Bootstrap in classloader
>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>>         at
>> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>         at
>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.createBootstrap(InstallerMBeanImpl.java:120)
>>         at
>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.(InstallerMBeanImpl.java:68)
>>         at
>> org.apache.servicemix.jbi.framework.InstallationService.initializeInstaller(InstallationService.java:447)
>>         at
>> org.apache.servicemix.jbi.framework.InstallationService.doInstallComp
>> onent(InstallationService.java:429)
>>         ...
>>
>> The only reference to Bootstrap in the tutorial is struck out, as if it is
>> deprecated, but obviously it is not so. After some reasoning out I created a
>> new MyBootstrap class which implements Bootstrap and implements its methods.
>> Ran again mvn install and tried to deploy it again and it worked (I think).
>>
>>   
>>     
> --> now as you are telling me this I can remember I had the same
> problems and I did solve them by adding my own bootstrap class. You did
> it correctly I think. Maybe gnodet or some other dev can tell you why
> the archetype for the BC isn't working as it should.
>
>   
>> 8. Create the SU.
>>
>> The steps to create the SU are missing. Guesswork again, I jumped around to
>> the Hello World SE tutorial instead. I again assume it is the same for both
>> BC and SE. From now on I am practically on my own jumping from other
>> tutorials and trying to figure things out the hard way:
>>
>>   
>>     
> --> wow, you are right. I really over-read this fact. It will be added soon.
> Basically you can use the archetype "servicemix-service-unit" for the SU
> creation in this case.
>
>   
>> I added the following dependency to pom.xml of hello-world-su:
>>
>>     
>>       org.apache.servicemix.samples.helloworld.bc
>>       hello-world-bc
>>       1.0-SNAPSHOT
>>   
>>     
> --> yes, this is correct if the version of your bc is really 1.0-SNAPSHOT
>
>   
>>     
>>
>> I added a new xbean.xml file under the resources folder of hello-world-su:
>>
>>   
>>     
> --> also done correctly. I suppose you used the servicemix-service-unit
> archetype which doesn't provide an own xbean.xml. But you may copy
> almost any other xbean...for example the xbean of the file-poller or
> something similar. Be sure to adapt the xbean file correctly as it uses
> some annotations of the endpoint classes.
> In this case the endpoint should be defined:
>
> <component:provider ......
>
> or
>
> <component:consumer ......
>
> The component comes from the
>
> /**
>  * @org.apache.xbean.XBean element="component"
>  */
> public class MyComponent extends DefaultComponent {
>
> --> see the annotation, it will be used.
>
>
> for provider or consumer see the corresponding classes
> MyConsumerEndpoint and MyProviderEndpoint...it's same there.
>
> Also have a look at your BC's pom.xml file. There is a important section
> to get your namespace for the SU:
>
>     ....
>      <plugin>
>         <groupId>org.apache.xbean</groupId>
>         <artifactId>maven-xbean-plugin</artifactId>
>         <version>${xbean-version}</version>
>         <executions>
>           <execution>
>             <configuration>
>
> --> see here the namespace, adapt it if you need to:
>               <namespace>http://${packageName}/1.0</namespace>
>
>             </configuration>
>             <goals>
>               <goal>mapping</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>     ....
>
> This namespace will be used in your SU's xbean.xml. Just replace the
> part after the xmlns:something="..." with your namespace set in the BC's
> pom.
>
> <?xml version="1.0"?>
> <beans xmlns:something="someuri">
>       <component:consumer ....
>   
>>   
>>
>>
>> Again even the Hello World SE tutorial has lots of explanations missing.
>>
>> I assume I am done with the SU and try mvn install in its directory.
>>
>>
>> 9. Create the SA
>>
>> Back to the original Hello World BC tutorial again.
>> Created the SA through Maven OK. 
>>
>> In the tutorial there is the following confusing statement:
>>
>> The hello-world-smx directory should now contain the following two
>> directories: 
>> $ ls 
>> hello-world-sa hello-world-bc
>> If the SU is needed, where is its directory??
>>   
>>     
> --> it seems the author saw that the SU creation isn't in the wiki so he
> skipped it here as well. of course the SU directory is missing here.
>
>
>   
>> The tutorial proceeds with stating that the following needs to be added to
>> the SA pom.xml:
>>
>>     
>>       org.apache.servicemix.samples.helloworld.bc
>>       hello-world-bc
>>       1.0-SNAPSHOT
>>     
>>
>> What about the SU??
>>   
>>     
> Imho this also makes no sense to me, but maybe there are existing other
> deployment methods which make it possible.
> The SA should only have the SU as dependency. The BC is a dependency of
> the SU.
>
>   
>> I proceed blindly with mvn install within the SA directory.
>>
>> 10. The top level project
>>
>> The tutorial states: Now that we have created the SU and SA projects a top
>> level pom.xml must be manually created and made aware of each subproject.
>> pom.xml needs to be edited to include each subproject.
>>
>>   
>>     
> --> there is an open JIRA for having such a super pom archetype. Until
> it is solved you have to do it manually.
>
> The pom should look like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0" 
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>
>   <modelVersion>4.0.0</modelVersion>
>
>   <groupId>org.apache.servicemix.samples.helloworld</groupId>
>   <artifactId>hello-world-smx</artifactId>
>   <packaging>pom</packaging>
>   <version>1.0-SNAPSHOT</version>
>   <name>Hello World JBI Component</name>
>
>   <modules>
>     <module>hello-world-bc</module>
>     <module>hello-world-su</module>
>     <module>hello-world-sa</module>
>   </modules>
>
> </project>
>
>
> Remember this is only a build tool's instruction file. It has nothing to
> do with smx at this moment. It builds the BC first, then the SU and
> finally the SA so all the internal dependencies are fine.
>
>
>   
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>>
>>   4.0.0
>>
>>   org.apache.servicemix.samples.helloworld
>>   hello-world-smx
>>   pom
>>   1.0-SNAPSHOT
>>   Hello World JBI Component
>>
>>   
>>     hello-world-sa
>>     hello-world-bc
>>   
>>
>>
>>
>> Again, where is the SU?
>>
>> The tutorial proceeds further stating that an ls should list the following
>> files.
>>
>> $ ls 
>> hello-world-sa hello-world-bc pom.xml
>>   
>>     
> no, it better should be:
>
> $ ls 
> hello-world-bc hello-world-sa hello-world-su pom.xml
>
>
>
>   
>> If the SU is needed, where is it going to be included?
>>
>>
>> 11. Give Each of the Maven Subprojects a Name
>> 12. mvn clean install of the root folder 
>>
>> 13. Deploying the Component 
>>
>> Now that the SA is built, we're ready to deploy it to the JBI container. 
>> This is a work in progress. I will finish this up very soon.
>>
>> Again missing information.
>>
>> I just copied hello-world-sa-1.0-SNAPSHOT.jar.
>>   
>>     
> You have to copy the BC and the SA zip files to the hotdeploy folder.
>
>
>
>   
>> At this point I am really looking forward to test the component out, so I
>> just modified MySpringComponentTest to use the RemoteServiceMixClient in
>> this way:
>>
>> RemoteServiceMixClient rc = new 
>> RemoteServiceMixClient("tcp://localhost:61616");
>>
>> I am shooting blindly at this point since I am not sure what the QName URN
>> should be etc., but assuming that it worked before on the
>> DefaultServiceMixClient I try it out just the same.
>>
>> I get the following error:
>>
>> 3253 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  - ServiceName
>> ({urn:test}service) specified for routing, but can't find it registered
>> ...
>> javax.jbi.messaging.MessagingException: Could not find route for exchange:
>> InOut[
>>   id: ID:10.0.0.1-1191902c607-3:0
>>   status: Active
>>   role: provider
>>   service: {urn:test}service
>>   in: <?xml version="1.0" encoding="UTF-8"?>world
>> ] for service: {urn:test}service and interface: null
>> 	at
>> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
>> 	at
>> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
>> ...
>>
>>   
>>     
> --> the endpoint uri was wrong. See my above comments about the
> namespace thing.
>
>   
>> With all the assumptions and guesswork I had to do, this tutorial is
>> definitely NOT straightforward. I would appreciate if someone could correct
>> me where I did a wrong step and tell me what I have to do to eventually test
>> the component with RemoteServiceMixClient.
>>
>>   
>>     
> --> you are right. it really needs a rework.
>
> Regards
> Lars
>
>
>   
>> Thanks.
>>
>>
>>
>>
>> lhe77 wrote:
>>   
>>     
>>> Yes, the service unit is needed because it configures the BC.
>>> I had a look at the Hello World BC wiki page and it looks not that bad
>>> as you described it.
>>>
>>> Maybe you did not really understand how BC/SE, SU and SA plays together.
>>> BC and SE are engines, which are deployed to the smx. But when doing it,
>>> it does not
>>> mean that you have then a working Hello World example. For doing such
>>> example you have to deploy a Hello World ServiceUnit which configures an
>>> endpoint using the BC in a ServiceAssembly.
>>>
>>> Please re-read the whole wiki page and don't skip out things. If you
>>> still have problems please describe what you already did and what's the
>>> problem exactly.
>>>
>>> Regards
>>> Lars
>>>
>>>
>>>
>>>
>>> jbx schrieb:
>>>     
>>>       
>>>> Hi all,
>>>>
>>>> First of all I am a newbie, so please ignore my ignorance if my question
>>>> is
>>>> obvious.
>>>>
>>>> I have tried to follow the HelloWorld-BC tutorial but it is quite
>>>> incomplete, so I hope to close the gaps here. I tried to look around and
>>>> lots of people seemed to have problems too but there are no clear answers
>>>> to
>>>> my questions.
>>>>
>>>> 1. Is the Service Unit needed? If yes can I follow some other tutorial to
>>>> get it done? I tried to follow the steps from other tutorials, but not
>>>> sure
>>>> if I omitted something. In the Hello-World-BC tutorial there is just
>>>> this:
>>>>
>>>> == 1. Creating a Hello World BC Service Unit 
>>>> This is a work in progress 
>>>>
>>>> 2. What are the steps to deploy the BC into the actual ServiceMix? Same
>>>> problem with the documentation:
>>>>
>>>> == Deploying the Component 
>>>> Now that the SA is built, we're ready to deploy it to the JBI container. 
>>>>
>>>> This is a work in progress. I will finish this up very soon
>>>>
>>>> I tried to reason things out and got to a point where I finally got
>>>> ServiceMix to load my hello-world-sa (created the missing
>>>> MyBootstrap.java
>>>> etc.) However I must have missed something.
>>>>
>>>> I modified the MySpringComponentTest to use the RemoteServiceMixClient
>>>> instead to access the ServiceMix JVM:
>>>>
>>>> RemoteServiceMixClient rc = new 
>>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>>
>>>>  but I just got this error:
>>>>
>>>> 4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>>> ServiceName
>>>> ({urn:test}service) specified for routing, but can't find it registered
>>>>
>>>>
>>>> I suspect that this is something related to endpoints and the way the BC
>>>> was
>>>> deployed, but I have no idea what to do next.
>>>>
>>>> In the end I just want to learn how to develop my own BC for a specific
>>>> protocol and have it accessible on the [ServiceMix] ESB from other
>>>> clients
>>>> remotely.
>>>>
>>>> Thanks.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   
>>>>       
>>>>         
>>>     
>>>       
>>   
>>     
>
>   

Re: HelloWorld BC

Posted by Lars Heinemann <la...@compart.net>.
I think now I better understand your point of view.
The tutorial really lacks some important information and is also
plain wrong in some descriptions. I will update this tutorial asap.

For the meanwhile...see my comments inside your mail:


jbx schrieb:
> Hi Lars, 
>
> The fact that you have to skip from one tutorial to another trying to
> 'infer' how things should be done (apart from the fact that the latest Maven
> and its Archetypes do not match the tutorial) simply confuses newbies and
> creates immense frustration instead of appreciation of the strength of the
> technology they're trying to learn. 
>
> How should someone who has just heard about a Service Unit suddenly become
> an expert and 'know' how to do the SU for a BC if it is not in the tutorial?
>
> Just to verify that I am not missing anything out I have done everything
> from scratch again, sorry if its long:
>
> 1. Created directory hello-world-smx and changed the working directory to
> it.
> 2. Created the servicemix-binding-component archetype from maven
>  
> Problem: This does not work:
>
> mvn archetype:create \ 
> -DarchetypeGroupId=org.apache.servicemix.tooling \
> -DarchetypeArtifactId=servicemix-binding-component \
> -DarchetypeVersion=3.2.1 \
> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
> -DartifactId=hello-world-bc 
>
> To follow the tutorial in the same way it has to be:
> mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \ 
> -DarchetypeGroupId=org.apache.servicemix.tooling \
> -DarchetypeArtifactId=servicemix-binding-component \
> -DarchetypeVersion=3.2.1 \
> -DgroupId=org.apache.servicemix.samples.helloworld.bc \
> -DartifactId=hello-world-bc 
>
> It worked for the Getting Started tutorials, so I guess nothing wrong with
> the above.
>   
--> This is a known issue for which even a JIRA exists. The solution you
choose was correct.
      I will put a hint to the section in the tutorial.



> 3. mvn install worked.
> 4. created the respective IDE project file: mvn idea:idea
> 5. modified MyProviderEndpoint.processInOut() accordingly
> 6. modified MySpringComponentTest accordingly and performed mvn install
>
> When executing MySpringComponentTest it works fine and the hello-world-bc
> converts the message.
>
> 7. Deploying the BC to ServiceMix. 
>
> It is not clear if the BC is separate to the SU or the SU is a zip file
> which also contains the BC. In this tutorial it states that mvn install has
> created an install zip file which can be deployed into servicemix, but this
> does not complete the deployment of the BC since it needs an SU. 
>   
--> imho the BC should be deployed standalone as it should a generic
protocol bridge
which may be used by several other service units. The zip file of the bc
is just dropped to the hotdeploy folder of your smx installation and
will be deployed automatically.

> From other places on the service-mix site I learnt that an SU is essentially
> like a war file. So one thinks, should I create the SU before deploying the
> BC into servicemix and deploy 1 zip file (like we do for a webapp) which
> contains the SU which in itself contains the BC. This is quite confusing.
>   
--> no, the BC should be the first step to create. when the bc is
deployed you may create a SU and the SA which is in fact only a deploy
format for the SU and the SA's zip will be dropped into the hotdeploy
folder as well. If the dependency settings of your SU are pointing to
your BC then it should even tell you if the BC is not deployed to smx.
You can try it if you remove the BC and try to deploy only the SA. smx
will tell you in the console that it now awaits the deployment of the
hello-world-bc before finishing the deployment of the SA.

> I put the BC install file into servicemix /hotdeploy, even though this seems
> to contradict the above reasoning, but I guess I misunderstood something
> here.
>
> Problem:
>
> ERROR - InstallerMBeanImpl             - Class not found:
> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
> java.lang.ClassNotFoundException:
> org.apache.servicemix.samples.helloworld.bc.My
> Bootstrap in classloader
> org.apache.servicemix.samples.helloworld.bc.MyBootstrap
>         at
> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>         at
> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.createBootstrap(InstallerMBeanImpl.java:120)
>         at
> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.(InstallerMBeanImpl.java:68)
>         at
> org.apache.servicemix.jbi.framework.InstallationService.initializeInstaller(InstallationService.java:447)
>         at
> org.apache.servicemix.jbi.framework.InstallationService.doInstallComp
> onent(InstallationService.java:429)
>         ...
>
> The only reference to Bootstrap in the tutorial is struck out, as if it is
> deprecated, but obviously it is not so. After some reasoning out I created a
> new MyBootstrap class which implements Bootstrap and implements its methods.
> Ran again mvn install and tried to deploy it again and it worked (I think).
>
>   
--> now as you are telling me this I can remember I had the same
problems and I did solve them by adding my own bootstrap class. You did
it correctly I think. Maybe gnodet or some other dev can tell you why
the archetype for the BC isn't working as it should.

> 8. Create the SU.
>
> The steps to create the SU are missing. Guesswork again, I jumped around to
> the Hello World SE tutorial instead. I again assume it is the same for both
> BC and SE. From now on I am practically on my own jumping from other
> tutorials and trying to figure things out the hard way:
>
>   
--> wow, you are right. I really over-read this fact. It will be added soon.
Basically you can use the archetype "servicemix-service-unit" for the SU
creation in this case.

> I added the following dependency to pom.xml of hello-world-su:
>
>     
>       org.apache.servicemix.samples.helloworld.bc
>       hello-world-bc
>       1.0-SNAPSHOT
>   
--> yes, this is correct if the version of your bc is really 1.0-SNAPSHOT

>     
>
> I added a new xbean.xml file under the resources folder of hello-world-su:
>
>   
--> also done correctly. I suppose you used the servicemix-service-unit
archetype which doesn't provide an own xbean.xml. But you may copy
almost any other xbean...for example the xbean of the file-poller or
something similar. Be sure to adapt the xbean file correctly as it uses
some annotations of the endpoint classes.
In this case the endpoint should be defined:

<component:provider ......

or

<component:consumer ......

The component comes from the

/**
 * @org.apache.xbean.XBean element="component"
 */
public class MyComponent extends DefaultComponent {

--> see the annotation, it will be used.


for provider or consumer see the corresponding classes
MyConsumerEndpoint and MyProviderEndpoint...it's same there.

Also have a look at your BC's pom.xml file. There is a important section
to get your namespace for the SU:

    ....
     <plugin>
        <groupId>org.apache.xbean</groupId>
        <artifactId>maven-xbean-plugin</artifactId>
        <version>${xbean-version}</version>
        <executions>
          <execution>
            <configuration>

--> see here the namespace, adapt it if you need to:
              <namespace>http://${packageName}/1.0</namespace>

            </configuration>
            <goals>
              <goal>mapping</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    ....

This namespace will be used in your SU's xbean.xml. Just replace the
part after the xmlns:something="..." with your namespace set in the BC's
pom.

<?xml version="1.0"?>
<beans xmlns:something="someuri">
      <component:consumer ....
>   
>
>
> Again even the Hello World SE tutorial has lots of explanations missing.
>
> I assume I am done with the SU and try mvn install in its directory.
>
>
> 9. Create the SA
>
> Back to the original Hello World BC tutorial again.
> Created the SA through Maven OK. 
>
> In the tutorial there is the following confusing statement:
>
> The hello-world-smx directory should now contain the following two
> directories: 
> $ ls 
> hello-world-sa hello-world-bc
> If the SU is needed, where is its directory??
>   
--> it seems the author saw that the SU creation isn't in the wiki so he
skipped it here as well. of course the SU directory is missing here.


> The tutorial proceeds with stating that the following needs to be added to
> the SA pom.xml:
>
>     
>       org.apache.servicemix.samples.helloworld.bc
>       hello-world-bc
>       1.0-SNAPSHOT
>     
>
> What about the SU??
>   
Imho this also makes no sense to me, but maybe there are existing other
deployment methods which make it possible.
The SA should only have the SU as dependency. The BC is a dependency of
the SU.

> I proceed blindly with mvn install within the SA directory.
>
> 10. The top level project
>
> The tutorial states: Now that we have created the SU and SA projects a top
> level pom.xml must be manually created and made aware of each subproject.
> pom.xml needs to be edited to include each subproject.
>
>   
--> there is an open JIRA for having such a super pom archetype. Until
it is solved you have to do it manually.

The pom should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>org.apache.servicemix.samples.helloworld</groupId>
  <artifactId>hello-world-smx</artifactId>
  <packaging>pom</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Hello World JBI Component</name>

  <modules>
    <module>hello-world-bc</module>
    <module>hello-world-su</module>
    <module>hello-world-sa</module>
  </modules>

</project>


Remember this is only a build tool's instruction file. It has nothing to
do with smx at this moment. It builds the BC first, then the SU and
finally the SA so all the internal dependencies are fine.


> <?xml version="1.0" encoding="UTF-8"?>
>
>
>   4.0.0
>
>   org.apache.servicemix.samples.helloworld
>   hello-world-smx
>   pom
>   1.0-SNAPSHOT
>   Hello World JBI Component
>
>   
>     hello-world-sa
>     hello-world-bc
>   
>
>
>
> Again, where is the SU?
>
> The tutorial proceeds further stating that an ls should list the following
> files.
>
> $ ls 
> hello-world-sa hello-world-bc pom.xml
>   
no, it better should be:

$ ls 
hello-world-bc hello-world-sa hello-world-su pom.xml



> If the SU is needed, where is it going to be included?
>
>
> 11. Give Each of the Maven Subprojects a Name
> 12. mvn clean install of the root folder 
>
> 13. Deploying the Component 
>
> Now that the SA is built, we're ready to deploy it to the JBI container. 
> This is a work in progress. I will finish this up very soon.
>
> Again missing information.
>
> I just copied hello-world-sa-1.0-SNAPSHOT.jar.
>   
You have to copy the BC and the SA zip files to the hotdeploy folder.



> At this point I am really looking forward to test the component out, so I
> just modified MySpringComponentTest to use the RemoteServiceMixClient in
> this way:
>
> RemoteServiceMixClient rc = new 
> RemoteServiceMixClient("tcp://localhost:61616");
>
> I am shooting blindly at this point since I am not sure what the QName URN
> should be etc., but assuming that it worked before on the
> DefaultServiceMixClient I try it out just the same.
>
> I get the following error:
>
> 3253 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  - ServiceName
> ({urn:test}service) specified for routing, but can't find it registered
> ...
> javax.jbi.messaging.MessagingException: Could not find route for exchange:
> InOut[
>   id: ID:10.0.0.1-1191902c607-3:0
>   status: Active
>   role: provider
>   service: {urn:test}service
>   in: <?xml version="1.0" encoding="UTF-8"?>world
> ] for service: {urn:test}service and interface: null
> 	at
> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
> 	at
> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
> ...
>
>   
--> the endpoint uri was wrong. See my above comments about the
namespace thing.

> With all the assumptions and guesswork I had to do, this tutorial is
> definitely NOT straightforward. I would appreciate if someone could correct
> me where I did a wrong step and tell me what I have to do to eventually test
> the component with RemoteServiceMixClient.
>
>   
--> you are right. it really needs a rework.

Regards
Lars


> Thanks.
>
>
>
>
> lhe77 wrote:
>   
>> Yes, the service unit is needed because it configures the BC.
>> I had a look at the Hello World BC wiki page and it looks not that bad
>> as you described it.
>>
>> Maybe you did not really understand how BC/SE, SU and SA plays together.
>> BC and SE are engines, which are deployed to the smx. But when doing it,
>> it does not
>> mean that you have then a working Hello World example. For doing such
>> example you have to deploy a Hello World ServiceUnit which configures an
>> endpoint using the BC in a ServiceAssembly.
>>
>> Please re-read the whole wiki page and don't skip out things. If you
>> still have problems please describe what you already did and what's the
>> problem exactly.
>>
>> Regards
>> Lars
>>
>>
>>
>>
>> jbx schrieb:
>>     
>>> Hi all,
>>>
>>> First of all I am a newbie, so please ignore my ignorance if my question
>>> is
>>> obvious.
>>>
>>> I have tried to follow the HelloWorld-BC tutorial but it is quite
>>> incomplete, so I hope to close the gaps here. I tried to look around and
>>> lots of people seemed to have problems too but there are no clear answers
>>> to
>>> my questions.
>>>
>>> 1. Is the Service Unit needed? If yes can I follow some other tutorial to
>>> get it done? I tried to follow the steps from other tutorials, but not
>>> sure
>>> if I omitted something. In the Hello-World-BC tutorial there is just
>>> this:
>>>
>>> == 1. Creating a Hello World BC Service Unit 
>>> This is a work in progress 
>>>
>>> 2. What are the steps to deploy the BC into the actual ServiceMix? Same
>>> problem with the documentation:
>>>
>>> == Deploying the Component 
>>> Now that the SA is built, we're ready to deploy it to the JBI container. 
>>>
>>> This is a work in progress. I will finish this up very soon
>>>
>>> I tried to reason things out and got to a point where I finally got
>>> ServiceMix to load my hello-world-sa (created the missing
>>> MyBootstrap.java
>>> etc.) However I must have missed something.
>>>
>>> I modified the MySpringComponentTest to use the RemoteServiceMixClient
>>> instead to access the ServiceMix JVM:
>>>
>>> RemoteServiceMixClient rc = new 
>>> RemoteServiceMixClient("tcp://localhost:61616");
>>>
>>>  but I just got this error:
>>>
>>> 4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>>> ServiceName
>>> ({urn:test}service) specified for routing, but can't find it registered
>>>
>>>
>>> I suspect that this is something related to endpoints and the way the BC
>>> was
>>> deployed, but I have no idea what to do next.
>>>
>>> In the end I just want to learn how to develop my own BC for a specific
>>> protocol and have it accessible on the [ServiceMix] ESB from other
>>> clients
>>> remotely.
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>>
>>>
>>>   
>>>       
>>     
>
>   

Re: HelloWorld BC

Posted by Guillaume Nodet <gn...@gmail.com>.
I think we do hear you, but creating a JBI component is not the best way to
get started.  There are a number of tutorials and examples available and I
would advise to dig a bit into those to have a better undersanding of JBI
and ServiceMix and the tools used (maven, spring, etc...).  Then, coming
back to this tutorial should be much easier I think.

On Wed, Apr 9, 2008 at 11:00 AM, jbx <jo...@gmail.com> wrote:

>
> Hi Bruce,
>
> > Since you are new to JBI and SMX and you do have a need to write BCs
> and maybe SEs, and you have a fresh perspective, we would really
> appreciate any feedback about how those tutorials can be improved as
> much as possible.
>
> Sure! As a start check the list of problems I had (earlier in this thread)
> with the latest Maven, the problems with the archetypes and the SU.
> Another
> thing is that the tutorials have a bit of steep learning curve because,
> (in
> my humble opinion) they assume you know a lot of other stuff which a
> newbie
> doesnt necessarily know. I think that often the newbie who is exploring
> JBI
> has a clear understanding of what his problems are and how SOA
> theoretically
> solves them, but he doesnt have the faintest idea from where to start (at
> least that is my case).
>
> Feel free to mail me personally when you are reviewing the tutorials if
> you
> need further feedback from me.
>
> I think that a simple but fullcase-study would also help close the gaps
> for
> the ultimate step-by-step tutorial. I will create a separate thread of
> what
> I think should be there not to pollute further this thread.
>
> I wasnt aware of what Camel and servicemix-cxf were capable of....
> Information overload! :)
>
> BR
>
>
>
> bsnyder wrote:
> >
> > On Wed, Apr 9, 2008 at 1:52 AM, jbx <jo...@gmail.com> wrote:
> >>
> >>  Hi Bruce,
> >>
> >>  Thanks for your input. Yes I read that document and thats where I
> >> concluded
> >>  that I needed to know more about how to create a BC.
> >
> > OK, great, that document was written in the hopes of helping folks
> > understand that as a newbie you're not require to create BCs and SEs.
> >
> >>  Unfortunately in reality (at least in my reality) the whole point of
> >> using
> >>  JBI and ESB is to decouple the business logic from the binding
> >>  implementations. Integrating with legacy systems is a must and
> although
> >> the
> >>  Getting Started tutorials are fine to get hot on the topic, assuming
> >> that
> >>  the only external binding requirements are picking up files, sending
> >> emails
> >>  and invoking web-services etc is too simplistic. In my environment I
> >> have to
> >>  deal with binary protocols from different vendors/platforms which
> makes
> >>  integration a headache when business requirements start to get
> >> complicated
> >>  and need different systems to interact and be orchestrated. Thats why
> I
> >> am
> >>  giving lots of priority to the BC development.
> >
> > Then you are correct; your situation is different than the typical
> > newbie. You actually do have a valid need to write BCs for connecting
> > to the legacy systems. That being said, the only tutorials available
> > for this are the two Hello World BC/SE tutorials that I created.
> > Unfortunately I haven't been able to polish them up really, really
> > well just simply due to time.
> >
> > Since you are new to JBI and SMX and you do have a need to write BCs
> > and maybe SEs, and you have a fresh perspective, we would really
> > appreciate any feedback about how those tutorials can be improved as
> > much as possible. SMX does provide the JBI Component Framework to
> > simplify the creation of JBI components:
> >
> > http://servicemix.apache.org/jbi-component-framework.html
> >
> > But definitely any feedback you can provide to improve the Hello World
> > tutorial would be great.
> >
> >>  Apart from that, how do you go about interacting with persistent
> systems
> >>  like saving to a database or file or LDAP? What about using standard
> >> stuff
> >>  such as JPA/Hibernate to interact with databases? Its still a bit of a
> >>  mystery to me about what should go where in these cases, but I guess I
> >>  should post a new thread about it.
> >
> > Lars' reply is correct, the first thing to look into using is the
> > servicemix-camel JBI component because Camel offers quite a lot of
> > connectivity already. But if Camel doesn't suit your needs, you can
> > use the servicemix-bean component to wrap POJO-ish type beans and then
> > in your POJOs you can access anything at all. Again, if along the way
> > you see points for improvement we'd love to hear the feedback. And
> > your observation is correct that starting a different discussion for
> > different topics is a good idea so that no single discussion becomes a
> > kitchen sink.
> >
> >>  If there is a simpler way to go around this (or I am missing some
> >> obvious
> >>  point) please dont hesitate to show me around. I know that there is
> also
> >>  JSR181 for POJO support, but I havent looked into it in detail because
> I
> >>  dont know if it is something standard or a sort of quick hack. There
> is
> >> only
> >>  that quick one-pager with lots of XML without an explanation of what
> >> means
> >>  what.
> >
> > Yes, you could certainly look at using the servicemix-jsr181 component
> > for WSDL and web services, but we're starting to advise folks to
> > instead use the servicemix-cxf-bc and servicemix-cxf-se components.
> > These two components utilize the Apache CXF project for web services
> > related technologies such as JAX-WS, WS-Addressing, WS-Policy,
> > WS-ReliableMessaging, WS-Security and much more. We're starting to
> > consider the servicemix-jsr181 component a bit deprecated as the CXF
> > components are much more advanced and CXF is what was used for
> > Geronimo to earn its Java EE certification. But if you have more
> > questions, please definitely let us know so that we can discuss each
> > topic specifically.
> >
> > Bruce
> > --
> > perl -e 'print
> > unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> > );'
> >
> > Apache ActiveMQ - http://activemq.org/
> > Apache Camel - http://activemq.org/camel/
> > Apache ServiceMix - http://servicemix.org/
> > Apache Geronimo - http://geronimo.apache.org/
> >
> > Blog: http://bruceblog.org/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/HelloWorld-BC-tp16467761p16582576.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: HelloWorld BC

Posted by jbx <jo...@gmail.com>.
Hi Bruce,

> Since you are new to JBI and SMX and you do have a need to write BCs
and maybe SEs, and you have a fresh perspective, we would really
appreciate any feedback about how those tutorials can be improved as
much as possible.

Sure! As a start check the list of problems I had (earlier in this thread)
with the latest Maven, the problems with the archetypes and the SU. Another
thing is that the tutorials have a bit of steep learning curve because, (in
my humble opinion) they assume you know a lot of other stuff which a newbie
doesnt necessarily know. I think that often the newbie who is exploring JBI
has a clear understanding of what his problems are and how SOA theoretically
solves them, but he doesnt have the faintest idea from where to start (at
least that is my case).

Feel free to mail me personally when you are reviewing the tutorials if you
need further feedback from me.

I think that a simple but fullcase-study would also help close the gaps for
the ultimate step-by-step tutorial. I will create a separate thread of what
I think should be there not to pollute further this thread.

I wasnt aware of what Camel and servicemix-cxf were capable of....
Information overload! :)

BR



bsnyder wrote:
> 
> On Wed, Apr 9, 2008 at 1:52 AM, jbx <jo...@gmail.com> wrote:
>>
>>  Hi Bruce,
>>
>>  Thanks for your input. Yes I read that document and thats where I
>> concluded
>>  that I needed to know more about how to create a BC.
> 
> OK, great, that document was written in the hopes of helping folks
> understand that as a newbie you're not require to create BCs and SEs.
> 
>>  Unfortunately in reality (at least in my reality) the whole point of
>> using
>>  JBI and ESB is to decouple the business logic from the binding
>>  implementations. Integrating with legacy systems is a must and although
>> the
>>  Getting Started tutorials are fine to get hot on the topic, assuming
>> that
>>  the only external binding requirements are picking up files, sending
>> emails
>>  and invoking web-services etc is too simplistic. In my environment I
>> have to
>>  deal with binary protocols from different vendors/platforms which makes
>>  integration a headache when business requirements start to get
>> complicated
>>  and need different systems to interact and be orchestrated. Thats why I
>> am
>>  giving lots of priority to the BC development.
> 
> Then you are correct; your situation is different than the typical
> newbie. You actually do have a valid need to write BCs for connecting
> to the legacy systems. That being said, the only tutorials available
> for this are the two Hello World BC/SE tutorials that I created.
> Unfortunately I haven't been able to polish them up really, really
> well just simply due to time.
> 
> Since you are new to JBI and SMX and you do have a need to write BCs
> and maybe SEs, and you have a fresh perspective, we would really
> appreciate any feedback about how those tutorials can be improved as
> much as possible. SMX does provide the JBI Component Framework to
> simplify the creation of JBI components:
> 
> http://servicemix.apache.org/jbi-component-framework.html
> 
> But definitely any feedback you can provide to improve the Hello World
> tutorial would be great.
> 
>>  Apart from that, how do you go about interacting with persistent systems
>>  like saving to a database or file or LDAP? What about using standard
>> stuff
>>  such as JPA/Hibernate to interact with databases? Its still a bit of a
>>  mystery to me about what should go where in these cases, but I guess I
>>  should post a new thread about it.
> 
> Lars' reply is correct, the first thing to look into using is the
> servicemix-camel JBI component because Camel offers quite a lot of
> connectivity already. But if Camel doesn't suit your needs, you can
> use the servicemix-bean component to wrap POJO-ish type beans and then
> in your POJOs you can access anything at all. Again, if along the way
> you see points for improvement we'd love to hear the feedback. And
> your observation is correct that starting a different discussion for
> different topics is a good idea so that no single discussion becomes a
> kitchen sink.
> 
>>  If there is a simpler way to go around this (or I am missing some
>> obvious
>>  point) please dont hesitate to show me around. I know that there is also
>>  JSR181 for POJO support, but I havent looked into it in detail because I
>>  dont know if it is something standard or a sort of quick hack. There is
>> only
>>  that quick one-pager with lots of XML without an explanation of what
>> means
>>  what.
> 
> Yes, you could certainly look at using the servicemix-jsr181 component
> for WSDL and web services, but we're starting to advise folks to
> instead use the servicemix-cxf-bc and servicemix-cxf-se components.
> These two components utilize the Apache CXF project for web services
> related technologies such as JAX-WS, WS-Addressing, WS-Policy,
> WS-ReliableMessaging, WS-Security and much more. We're starting to
> consider the servicemix-jsr181 component a bit deprecated as the CXF
> components are much more advanced and CXF is what was used for
> Geronimo to earn its Java EE certification. But if you have more
> questions, please definitely let us know so that we can discuss each
> topic specifically.
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> Apache ActiveMQ - http://activemq.org/
> Apache Camel - http://activemq.org/camel/
> Apache ServiceMix - http://servicemix.org/
> Apache Geronimo - http://geronimo.apache.org/
> 
> Blog: http://bruceblog.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16582576.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: HelloWorld BC

Posted by Bruce Snyder <br...@gmail.com>.
On Wed, Apr 9, 2008 at 1:52 AM, jbx <jo...@gmail.com> wrote:
>
>  Hi Bruce,
>
>  Thanks for your input. Yes I read that document and thats where I concluded
>  that I needed to know more about how to create a BC.

OK, great, that document was written in the hopes of helping folks
understand that as a newbie you're not require to create BCs and SEs.

>  Unfortunately in reality (at least in my reality) the whole point of using
>  JBI and ESB is to decouple the business logic from the binding
>  implementations. Integrating with legacy systems is a must and although the
>  Getting Started tutorials are fine to get hot on the topic, assuming that
>  the only external binding requirements are picking up files, sending emails
>  and invoking web-services etc is too simplistic. In my environment I have to
>  deal with binary protocols from different vendors/platforms which makes
>  integration a headache when business requirements start to get complicated
>  and need different systems to interact and be orchestrated. Thats why I am
>  giving lots of priority to the BC development.

Then you are correct; your situation is different than the typical
newbie. You actually do have a valid need to write BCs for connecting
to the legacy systems. That being said, the only tutorials available
for this are the two Hello World BC/SE tutorials that I created.
Unfortunately I haven't been able to polish them up really, really
well just simply due to time.

Since you are new to JBI and SMX and you do have a need to write BCs
and maybe SEs, and you have a fresh perspective, we would really
appreciate any feedback about how those tutorials can be improved as
much as possible. SMX does provide the JBI Component Framework to
simplify the creation of JBI components:

http://servicemix.apache.org/jbi-component-framework.html

But definitely any feedback you can provide to improve the Hello World
tutorial would be great.

>  Apart from that, how do you go about interacting with persistent systems
>  like saving to a database or file or LDAP? What about using standard stuff
>  such as JPA/Hibernate to interact with databases? Its still a bit of a
>  mystery to me about what should go where in these cases, but I guess I
>  should post a new thread about it.

Lars' reply is correct, the first thing to look into using is the
servicemix-camel JBI component because Camel offers quite a lot of
connectivity already. But if Camel doesn't suit your needs, you can
use the servicemix-bean component to wrap POJO-ish type beans and then
in your POJOs you can access anything at all. Again, if along the way
you see points for improvement we'd love to hear the feedback. And
your observation is correct that starting a different discussion for
different topics is a good idea so that no single discussion becomes a
kitchen sink.

>  If there is a simpler way to go around this (or I am missing some obvious
>  point) please dont hesitate to show me around. I know that there is also
>  JSR181 for POJO support, but I havent looked into it in detail because I
>  dont know if it is something standard or a sort of quick hack. There is only
>  that quick one-pager with lots of XML without an explanation of what means
>  what.

Yes, you could certainly look at using the servicemix-jsr181 component
for WSDL and web services, but we're starting to advise folks to
instead use the servicemix-cxf-bc and servicemix-cxf-se components.
These two components utilize the Apache CXF project for web services
related technologies such as JAX-WS, WS-Addressing, WS-Policy,
WS-ReliableMessaging, WS-Security and much more. We're starting to
consider the servicemix-jsr181 component a bit deprecated as the CXF
components are much more advanced and CXF is what was used for
Geronimo to earn its Java EE certification. But if you have more
questions, please definitely let us know so that we can discuss each
topic specifically.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/

Blog: http://bruceblog.org/

Re: HelloWorld BC

Posted by Lars Heinemann <la...@compart.net>.
jbx,

also do have a look at the camel stuff as they provide lots of bindings
as well.
The only disadvantage of camel at the moment is the lack of attachment
support.

http://activemq.apache.org/camel/components.html

You can use these camel components in smx with the servicemix-camel
component:

http://servicemix.apache.org/servicemix-camel.html

See also the archetype:     servicemix-camel-service-unit
http://servicemix.apache.org/maven-archetypes.html

But of course you are right. If you got different protocols to work with
your bus and the smx doesn't support them yet, it's best to write a
binding component for this purpose.

Regards,
Lars




jbx schrieb:
> Hi Bruce,
>
> Thanks for your input. Yes I read that document and thats where I concluded
> that I needed to know more about how to create a BC.
>
> Unfortunately in reality (at least in my reality) the whole point of using
> JBI and ESB is to decouple the business logic from the binding
> implementations. Integrating with legacy systems is a must and although the
> Getting Started tutorials are fine to get hot on the topic, assuming that
> the only external binding requirements are picking up files, sending emails
> and invoking web-services etc is too simplistic. In my environment I have to
> deal with binary protocols from different vendors/platforms which makes
> integration a headache when business requirements start to get complicated
> and need different systems to interact and be orchestrated. Thats why I am
> giving lots of priority to the BC development. 
>
> Apart from that, how do you go about interacting with persistent systems
> like saving to a database or file or LDAP? What about using standard stuff
> such as JPA/Hibernate to interact with databases? Its still a bit of a
> mystery to me about what should go where in these cases, but I guess I
> should post a new thread about it.
>
> If there is a simpler way to go around this (or I am missing some obvious
> point) please dont hesitate to show me around. I know that there is also
> JSR181 for POJO support, but I havent looked into it in detail because I
> dont know if it is something standard or a sort of quick hack. There is only
> that quick one-pager with lots of XML without an explanation of what means
> what.
>
>
> Best Regards
>
>
>
>
>
>
> bsnyder wrote:
>   
>> On Fri, Apr 4, 2008 at 12:43 PM, jbx <jo...@gmail.com> wrote:
>>     
>>>  Hi Lars,
>>>
>>>  The fact that you have to skip from one tutorial to another trying to
>>>  'infer' how things should be done (apart from the fact that the latest
>>> Maven
>>>  and its Archetypes do not match the tutorial) simply confuses newbies
>>> and
>>>  creates immense frustration instead of appreciation of the strength of
>>> the
>>>  technology they're trying to learn.
>>>
>>>  How should someone who has just heard about a Service Unit suddenly
>>> become
>>>  an expert and 'know' how to do the SU for a BC if it is not in the
>>> tutorial?
>>>       
>> FWIW, creating a JBI component is not an activity for a new user as it
>> is a fairly advanced task requiring a fair amount of knowledge and has
>> not yet been well documented. Please note that you do not need to
>> create a JBI component in order to use ServiceMix. Many of the most
>> common components are provided with ServiceMix and just need to be
>> configured via a SU/SA combination.
>>
>> Also, the document below is linked to the Hello World BC and SE
>> tutorials to be read before beginning to create a JBI component:
>>
>> http://servicemix.apache.org/should-i-create-my-own-jbi-components.html
>>
>> This document might help to provide some context around the difference
>> between using the components provided by ServiceMix and developing new
>> components to expand the functionality of the ServiceMix container.
>>
>> Bruce
>> -- 
>> perl -e 'print
>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> );'
>>
>> Apache ActiveMQ - http://activemq.org/
>> Apache Camel - http://activemq.org/camel/
>> Apache ServiceMix - http://servicemix.org/
>> Apache Geronimo - http://geronimo.apache.org/
>>
>> Blog: http://bruceblog.org/
>>
>>
>>     
>
>   

Re: HelloWorld BC

Posted by jbx <jo...@gmail.com>.
Hi Bruce,

Thanks for your input. Yes I read that document and thats where I concluded
that I needed to know more about how to create a BC.

Unfortunately in reality (at least in my reality) the whole point of using
JBI and ESB is to decouple the business logic from the binding
implementations. Integrating with legacy systems is a must and although the
Getting Started tutorials are fine to get hot on the topic, assuming that
the only external binding requirements are picking up files, sending emails
and invoking web-services etc is too simplistic. In my environment I have to
deal with binary protocols from different vendors/platforms which makes
integration a headache when business requirements start to get complicated
and need different systems to interact and be orchestrated. Thats why I am
giving lots of priority to the BC development. 

Apart from that, how do you go about interacting with persistent systems
like saving to a database or file or LDAP? What about using standard stuff
such as JPA/Hibernate to interact with databases? Its still a bit of a
mystery to me about what should go where in these cases, but I guess I
should post a new thread about it.

If there is a simpler way to go around this (or I am missing some obvious
point) please dont hesitate to show me around. I know that there is also
JSR181 for POJO support, but I havent looked into it in detail because I
dont know if it is something standard or a sort of quick hack. There is only
that quick one-pager with lots of XML without an explanation of what means
what.


Best Regards






bsnyder wrote:
> 
> On Fri, Apr 4, 2008 at 12:43 PM, jbx <jo...@gmail.com> wrote:
>>
>>  Hi Lars,
>>
>>  The fact that you have to skip from one tutorial to another trying to
>>  'infer' how things should be done (apart from the fact that the latest
>> Maven
>>  and its Archetypes do not match the tutorial) simply confuses newbies
>> and
>>  creates immense frustration instead of appreciation of the strength of
>> the
>>  technology they're trying to learn.
>>
>>  How should someone who has just heard about a Service Unit suddenly
>> become
>>  an expert and 'know' how to do the SU for a BC if it is not in the
>> tutorial?
> 
> FWIW, creating a JBI component is not an activity for a new user as it
> is a fairly advanced task requiring a fair amount of knowledge and has
> not yet been well documented. Please note that you do not need to
> create a JBI component in order to use ServiceMix. Many of the most
> common components are provided with ServiceMix and just need to be
> configured via a SU/SA combination.
> 
> Also, the document below is linked to the Hello World BC and SE
> tutorials to be read before beginning to create a JBI component:
> 
> http://servicemix.apache.org/should-i-create-my-own-jbi-components.html
> 
> This document might help to provide some context around the difference
> between using the components provided by ServiceMix and developing new
> components to expand the functionality of the ServiceMix container.
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> Apache ActiveMQ - http://activemq.org/
> Apache Camel - http://activemq.org/camel/
> Apache ServiceMix - http://servicemix.org/
> Apache Geronimo - http://geronimo.apache.org/
> 
> Blog: http://bruceblog.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16576506.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: HelloWorld BC

Posted by Bruce Snyder <br...@gmail.com>.
On Fri, Apr 4, 2008 at 12:43 PM, jbx <jo...@gmail.com> wrote:
>
>  Hi Lars,
>
>  The fact that you have to skip from one tutorial to another trying to
>  'infer' how things should be done (apart from the fact that the latest Maven
>  and its Archetypes do not match the tutorial) simply confuses newbies and
>  creates immense frustration instead of appreciation of the strength of the
>  technology they're trying to learn.
>
>  How should someone who has just heard about a Service Unit suddenly become
>  an expert and 'know' how to do the SU for a BC if it is not in the tutorial?

FWIW, creating a JBI component is not an activity for a new user as it
is a fairly advanced task requiring a fair amount of knowledge and has
not yet been well documented. Please note that you do not need to
create a JBI component in order to use ServiceMix. Many of the most
common components are provided with ServiceMix and just need to be
configured via a SU/SA combination.

Also, the document below is linked to the Hello World BC and SE
tutorials to be read before beginning to create a JBI component:

http://servicemix.apache.org/should-i-create-my-own-jbi-components.html

This document might help to provide some context around the difference
between using the components provided by ServiceMix and developing new
components to expand the functionality of the ServiceMix container.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/

Blog: http://bruceblog.org/

Re: HelloWorld BC

Posted by jbx <jo...@gmail.com>.
Hi Lars, 

The fact that you have to skip from one tutorial to another trying to
'infer' how things should be done (apart from the fact that the latest Maven
and its Archetypes do not match the tutorial) simply confuses newbies and
creates immense frustration instead of appreciation of the strength of the
technology they're trying to learn. 

How should someone who has just heard about a Service Unit suddenly become
an expert and 'know' how to do the SU for a BC if it is not in the tutorial?

Just to verify that I am not missing anything out I have done everything
from scratch again, sorry if its long:

1. Created directory hello-world-smx and changed the working directory to
it.
2. Created the servicemix-binding-component archetype from maven
 
Problem: This does not work:

mvn archetype:create \ 
-DarchetypeGroupId=org.apache.servicemix.tooling \
-DarchetypeArtifactId=servicemix-binding-component \
-DarchetypeVersion=3.2.1 \
-DgroupId=org.apache.servicemix.samples.helloworld.bc \
-DartifactId=hello-world-bc 

To follow the tutorial in the same way it has to be:
mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \ 
-DarchetypeGroupId=org.apache.servicemix.tooling \
-DarchetypeArtifactId=servicemix-binding-component \
-DarchetypeVersion=3.2.1 \
-DgroupId=org.apache.servicemix.samples.helloworld.bc \
-DartifactId=hello-world-bc 

It worked for the Getting Started tutorials, so I guess nothing wrong with
the above.

3. mvn install worked.
4. created the respective IDE project file: mvn idea:idea
5. modified MyProviderEndpoint.processInOut() accordingly
6. modified MySpringComponentTest accordingly and performed mvn install

When executing MySpringComponentTest it works fine and the hello-world-bc
converts the message.

7. Deploying the BC to ServiceMix. 

It is not clear if the BC is separate to the SU or the SU is a zip file
which also contains the BC. In this tutorial it states that mvn install has
created an install zip file which can be deployed into servicemix, but this
does not complete the deployment of the BC since it needs an SU. 

>From other places on the service-mix site I learnt that an SU is essentially
like a war file. So one thinks, should I create the SU before deploying the
BC into servicemix and deploy 1 zip file (like we do for a webapp) which
contains the SU which in itself contains the BC. This is quite confusing.

I put the BC install file into servicemix /hotdeploy, even though this seems
to contradict the above reasoning, but I guess I misunderstood something
here.

Problem:

ERROR - InstallerMBeanImpl             - Class not found:
org.apache.servicemix.samples.helloworld.bc.MyBootstrap
java.lang.ClassNotFoundException:
org.apache.servicemix.samples.helloworld.bc.My
Bootstrap in classloader
org.apache.servicemix.samples.helloworld.bc.MyBootstrap
        at
org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at
org.apache.servicemix.jbi.framework.InstallerMBeanImpl.createBootstrap(InstallerMBeanImpl.java:120)
        at
org.apache.servicemix.jbi.framework.InstallerMBeanImpl.(InstallerMBeanImpl.java:68)
        at
org.apache.servicemix.jbi.framework.InstallationService.initializeInstaller(InstallationService.java:447)
        at
org.apache.servicemix.jbi.framework.InstallationService.doInstallComp
onent(InstallationService.java:429)
        ...

The only reference to Bootstrap in the tutorial is struck out, as if it is
deprecated, but obviously it is not so. After some reasoning out I created a
new MyBootstrap class which implements Bootstrap and implements its methods.
Ran again mvn install and tried to deploy it again and it worked (I think).


8. Create the SU.

The steps to create the SU are missing. Guesswork again, I jumped around to
the Hello World SE tutorial instead. I again assume it is the same for both
BC and SE. From now on I am practically on my own jumping from other
tutorials and trying to figure things out the hard way:

I added the following dependency to pom.xml of hello-world-su:

    
      org.apache.servicemix.samples.helloworld.bc
      hello-world-bc
      1.0-SNAPSHOT
    

I added a new xbean.xml file under the resources folder of hello-world-su:


  


Again even the Hello World SE tutorial has lots of explanations missing.

I assume I am done with the SU and try mvn install in its directory.


9. Create the SA

Back to the original Hello World BC tutorial again.
Created the SA through Maven OK. 

In the tutorial there is the following confusing statement:

The hello-world-smx directory should now contain the following two
directories: 
$ ls 
hello-world-sa hello-world-bc

If the SU is needed, where is its directory??

The tutorial proceeds with stating that the following needs to be added to
the SA pom.xml:

    
      org.apache.servicemix.samples.helloworld.bc
      hello-world-bc
      1.0-SNAPSHOT
    

What about the SU??

I proceed blindly with mvn install within the SA directory.

10. The top level project

The tutorial states: Now that we have created the SU and SA projects a top
level pom.xml must be manually created and made aware of each subproject.
pom.xml needs to be edited to include each subproject.

<?xml version="1.0" encoding="UTF-8"?>


  4.0.0

  org.apache.servicemix.samples.helloworld
  hello-world-smx
  pom
  1.0-SNAPSHOT
  Hello World JBI Component

  
    hello-world-sa
    hello-world-bc
  



Again, where is the SU?

The tutorial proceeds further stating that an ls should list the following
files.

$ ls 
hello-world-sa hello-world-bc pom.xml

If the SU is needed, where is it going to be included?


11. Give Each of the Maven Subprojects a Name
12. mvn clean install of the root folder 

13. Deploying the Component 

Now that the SA is built, we're ready to deploy it to the JBI container. 
This is a work in progress. I will finish this up very soon.

Again missing information.

I just copied hello-world-sa-1.0-SNAPSHOT.jar.

At this point I am really looking forward to test the component out, so I
just modified MySpringComponentTest to use the RemoteServiceMixClient in
this way:

RemoteServiceMixClient rc = new 
RemoteServiceMixClient("tcp://localhost:61616");

I am shooting blindly at this point since I am not sure what the QName URN
should be etc., but assuming that it worked before on the
DefaultServiceMixClient I try it out just the same.

I get the following error:

3253 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  - ServiceName
({urn:test}service) specified for routing, but can't find it registered
...
javax.jbi.messaging.MessagingException: Could not find route for exchange:
InOut[
  id: ID:10.0.0.1-1191902c607-3:0
  status: Active
  role: provider
  service: {urn:test}service
  in: <?xml version="1.0" encoding="UTF-8"?>world
] for service: {urn:test}service and interface: null
	at
org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
	at
org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
...


With all the assumptions and guesswork I had to do, this tutorial is
definitely NOT straightforward. I would appreciate if someone could correct
me where I did a wrong step and tell me what I have to do to eventually test
the component with RemoteServiceMixClient.

Thanks.




lhe77 wrote:
> 
> Yes, the service unit is needed because it configures the BC.
> I had a look at the Hello World BC wiki page and it looks not that bad
> as you described it.
> 
> Maybe you did not really understand how BC/SE, SU and SA plays together.
> BC and SE are engines, which are deployed to the smx. But when doing it,
> it does not
> mean that you have then a working Hello World example. For doing such
> example you have to deploy a Hello World ServiceUnit which configures an
> endpoint using the BC in a ServiceAssembly.
> 
> Please re-read the whole wiki page and don't skip out things. If you
> still have problems please describe what you already did and what's the
> problem exactly.
> 
> Regards
> Lars
> 
> 
> 
> 
> jbx schrieb:
>> Hi all,
>>
>> First of all I am a newbie, so please ignore my ignorance if my question
>> is
>> obvious.
>>
>> I have tried to follow the HelloWorld-BC tutorial but it is quite
>> incomplete, so I hope to close the gaps here. I tried to look around and
>> lots of people seemed to have problems too but there are no clear answers
>> to
>> my questions.
>>
>> 1. Is the Service Unit needed? If yes can I follow some other tutorial to
>> get it done? I tried to follow the steps from other tutorials, but not
>> sure
>> if I omitted something. In the Hello-World-BC tutorial there is just
>> this:
>>
>> == 1. Creating a Hello World BC Service Unit 
>> This is a work in progress 
>>
>> 2. What are the steps to deploy the BC into the actual ServiceMix? Same
>> problem with the documentation:
>>
>> == Deploying the Component 
>> Now that the SA is built, we're ready to deploy it to the JBI container. 
>>
>> This is a work in progress. I will finish this up very soon
>>
>> I tried to reason things out and got to a point where I finally got
>> ServiceMix to load my hello-world-sa (created the missing
>> MyBootstrap.java
>> etc.) However I must have missed something.
>>
>> I modified the MySpringComponentTest to use the RemoteServiceMixClient
>> instead to access the ServiceMix JVM:
>>
>> RemoteServiceMixClient rc = new 
>> RemoteServiceMixClient("tcp://localhost:61616");
>>
>>  but I just got this error:
>>
>> 4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>> ServiceName
>> ({urn:test}service) specified for routing, but can't find it registered
>>
>>
>> I suspect that this is something related to endpoints and the way the BC
>> was
>> deployed, but I have no idea what to do next.
>>
>> In the end I just want to learn how to develop my own BC for a specific
>> protocol and have it accessible on the [ServiceMix] ESB from other
>> clients
>> remotely.
>>
>> Thanks.
>>
>>
>>
>>
>>
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16490902.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: HelloWorld BC

Posted by jbx <jo...@gmail.com>.
Hi Lars, 

The fact that you have to skip from one tutorial to another trying to
'infer' how things should be done (apart from the fact that the latest Maven
and its Archetypes do not match the tutorial) simply confuses newbies and
creates immense frustration instead of appreciation of the strength of the
technology they're trying to learn. 

How should someone who has just heard about a Service Unit suddenly become
an expert and 'know' how to do the SU for a BC if it is not in the tutorial?

Just to verify that I am not missing anything out I have done everything
from scratch again, sorry if its long:

1. Created directory hello-world-smx and changed the working directory to
it.
2. Created the servicemix-binding-component archetype from maven
 
Problem: This does not work:

mvn archetype:create \ 
-DarchetypeGroupId=org.apache.servicemix.tooling \
-DarchetypeArtifactId=servicemix-binding-component \
-DarchetypeVersion=3.2.1 \
-DgroupId=org.apache.servicemix.samples.helloworld.bc \
-DartifactId=hello-world-bc 

To follow the tutorial in the same way it has to be:
mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \ 
-DarchetypeGroupId=org.apache.servicemix.tooling \
-DarchetypeArtifactId=servicemix-binding-component \
-DarchetypeVersion=3.2.1 \
-DgroupId=org.apache.servicemix.samples.helloworld.bc \
-DartifactId=hello-world-bc 

It worked for the Getting Started tutorials, so I guess nothing wrong with
the above.

3. mvn install worked.
4. created the respective IDE project file: mvn idea:idea
5. modified MyProviderEndpoint.processInOut() accordingly
6. modified MySpringComponentTest accordingly and performed mvn install

When executing MySpringComponentTest it works fine and the hello-world-bc
converts the message.

7. Deploying the BC to ServiceMix. 

It is not clear if the BC is separate to the SU or the SU is a zip file
which also contains the BC. In this tutorial it states that mvn install has
created an install zip file which can be deployed into servicemix, but this
does not complete the deployment of the BC since it needs an SU. 

>From other places on the service-mix site I learnt that an SU is essentially
like a war file. So one thinks, should I create the SU before deploying the
BC into servicemix and deploy 1 zip file (like we do for a webapp) which
contains the SU which in itself contains the BC. This is quite confusing.

I put the BC install file into servicemix /hotdeploy, even though this seems
to contradict the above reasoning, but I guess I misunderstood something
here.

Problem:

ERROR - InstallerMBeanImpl             - Class not found:
org.apache.servicemix.samples.helloworld.bc.MyBootstrap
java.lang.ClassNotFoundException:
org.apache.servicemix.samples.helloworld.bc.My
Bootstrap in classloader
org.apache.servicemix.samples.helloworld.bc.MyBootstrap
        at
org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at
org.apache.servicemix.jbi.framework.InstallerMBeanImpl.createBootstrap(InstallerMBeanImpl.java:120)
        at
org.apache.servicemix.jbi.framework.InstallerMBeanImpl.<init>(InstallerMBeanImpl.java:68)
        at
org.apache.servicemix.jbi.framework.InstallationService.initializeInstaller(InstallationService.java:447)
        at
org.apache.servicemix.jbi.framework.InstallationService.doInstallComp
onent(InstallationService.java:429)
        ...

The only reference to Bootstrap in the tutorial is struck out, as if it is
deprecated, but obviously it is not so. After some reasoning out I created a
new MyBootstrap class which implements Bootstrap and implements its methods.
Ran again mvn install and tried to deploy it again and it worked (I think).


8. Create the SU.

The steps to create the SU are missing. Guesswork again, I jumped around to
the Hello World SE tutorial instead. I again assume it is the same for both
BC and SE. From now on I am practically on my own jumping from other
tutorials and trying to figure things out the hard way:

I added the following dependency to pom.xml of hello-world-su:

    <dependency>
      <groupId>org.apache.servicemix.samples.helloworld.bc</groupId>
      <artifactId>hello-world-bc</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>

I added a new xbean.xml file under the resources folder of hello-world-su:

<beans xmlns:hwse="http://org.apache.servicemix.samples.helloworld.bc/1.0"
       xmlns:xyz="http://companyxyz.com">
  <hwse:endpoint service="xyz:helloWorld" endpoint="helloWorld"/>
</beans>

Again even the Hello World SE tutorial has lots of explanations missing.

I assume I am done with the SU and try mvn install in its directory.


9. Create the SA

Back to the original Hello World BC tutorial again.
Created the SA through Maven OK. 

In the tutorial there is the following confusing statement:

The hello-world-smx directory should now contain the following two
directories: 
$ ls 
hello-world-sa hello-world-bc

If the SU is needed, where is its directory??

The tutorial proceeds with stating that the following needs to be added to
the SA pom.xml:

    <dependency>
      <groupId>org.apache.servicemix.samples.helloworld.bc</groupId>
      <artifactId>hello-world-bc</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>

What about the SU??

I proceed blindly with mvn install within the SA directory.

10. The top level project

The tutorial states: Now that we have created the SU and SA projects a top
level pom.xml must be manually created and made aware of each subproject.
pom.xml needs to be edited to include each subproject.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>org.apache.servicemix.samples.helloworld</groupId>
  <artifactId>hello-world-smx</artifactId>
  <packaging>pom</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Hello World JBI Component</name>

  <modules>
    <module>hello-world-sa</module>
    <module>hello-world-bc</module>
  </modules>

</project>

Again, where is the SU?

The tutorial proceeds further stating that an ls should list the following
files.

$ ls 
hello-world-sa hello-world-bc pom.xml

If the SU is needed, where is it going to be included?


11. Give Each of the Maven Subprojects a Name
12. mvn clean install of the root folder 

13. Deploying the Component 

Now that the SA is built, we're ready to deploy it to the JBI container. 
This is a work in progress. I will finish this up very soon.

Again missing information.

I just copied hello-world-sa-1.0-SNAPSHOT.jar.

At this point I am really looking forward to test the component out, so I
just modified MySpringComponentTest to use the RemoteServiceMixClient in
this way:

RemoteServiceMixClient rc = new 
RemoteServiceMixClient("tcp://localhost:61616");

I am shooting blindly at this point since I am not sure what the QName URN
should be etc., but assuming that it worked before on the
DefaultServiceMixClient I try it out just the same.

I get the following error:

3253 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  - ServiceName
({urn:test}service) specified for routing, but can't find it registered
...
javax.jbi.messaging.MessagingException: Could not find route for exchange:
InOut[
  id: ID:10.0.0.1-1191902c607-3:0
  status: Active
  role: provider
  service: {urn:test}service
  in: <?xml version="1.0" encoding="UTF-8"?><hello>world</hello>
] for service: {urn:test}service and interface: null
	at
org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297)
	at
org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
...


With all the assumptions and guesswork I had to do, this tutorial is
definitely NOT straightforward. I would appreciate if someone could correct
me where I did a wrong step and tell me what I have to do to eventually test
the component with RemoteServiceMixClient.

Thanks.




lhe77 wrote:
> 
> Yes, the service unit is needed because it configures the BC.
> I had a look at the Hello World BC wiki page and it looks not that bad
> as you described it.
> 
> Maybe you did not really understand how BC/SE, SU and SA plays together.
> BC and SE are engines, which are deployed to the smx. But when doing it,
> it does not
> mean that you have then a working Hello World example. For doing such
> example you have to deploy a Hello World ServiceUnit which configures an
> endpoint using the BC in a ServiceAssembly.
> 
> Please re-read the whole wiki page and don't skip out things. If you
> still have problems please describe what you already did and what's the
> problem exactly.
> 
> Regards
> Lars
> 
> 
> 
> 
> jbx schrieb:
>> Hi all,
>>
>> First of all I am a newbie, so please ignore my ignorance if my question
>> is
>> obvious.
>>
>> I have tried to follow the HelloWorld-BC tutorial but it is quite
>> incomplete, so I hope to close the gaps here. I tried to look around and
>> lots of people seemed to have problems too but there are no clear answers
>> to
>> my questions.
>>
>> 1. Is the Service Unit needed? If yes can I follow some other tutorial to
>> get it done? I tried to follow the steps from other tutorials, but not
>> sure
>> if I omitted something. In the Hello-World-BC tutorial there is just
>> this:
>>
>> == 1. Creating a Hello World BC Service Unit 
>> This is a work in progress 
>>
>> 2. What are the steps to deploy the BC into the actual ServiceMix? Same
>> problem with the documentation:
>>
>> == Deploying the Component 
>> Now that the SA is built, we're ready to deploy it to the JBI container. 
>>
>> This is a work in progress. I will finish this up very soon
>>
>> I tried to reason things out and got to a point where I finally got
>> ServiceMix to load my hello-world-sa (created the missing
>> MyBootstrap.java
>> etc.) However I must have missed something.
>>
>> I modified the MySpringComponentTest to use the RemoteServiceMixClient
>> instead to access the ServiceMix JVM:
>>
>> RemoteServiceMixClient rc = new 
>> RemoteServiceMixClient("tcp://localhost:61616");
>>
>>  but I just got this error:
>>
>> 4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  -
>> ServiceName
>> ({urn:test}service) specified for routing, but can't find it registered
>>
>>
>> I suspect that this is something related to endpoints and the way the BC
>> was
>> deployed, but I have no idea what to do next.
>>
>> In the end I just want to learn how to develop my own BC for a specific
>> protocol and have it accessible on the [ServiceMix] ESB from other
>> clients
>> remotely.
>>
>> Thanks.
>>
>>
>>
>>
>>
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16490902.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: HelloWorld BC

Posted by Lars Heinemann <la...@compart.net>.
Yes, the service unit is needed because it configures the BC.
I had a look at the Hello World BC wiki page and it looks not that bad
as you described it.

Maybe you did not really understand how BC/SE, SU and SA plays together.
BC and SE are engines, which are deployed to the smx. But when doing it,
it does not
mean that you have then a working Hello World example. For doing such
example you have to deploy a Hello World ServiceUnit which configures an
endpoint using the BC in a ServiceAssembly.

Please re-read the whole wiki page and don't skip out things. If you
still have problems please describe what you already did and what's the
problem exactly.

Regards
Lars




jbx schrieb:
> Hi all,
>
> First of all I am a newbie, so please ignore my ignorance if my question is
> obvious.
>
> I have tried to follow the HelloWorld-BC tutorial but it is quite
> incomplete, so I hope to close the gaps here. I tried to look around and
> lots of people seemed to have problems too but there are no clear answers to
> my questions.
>
> 1. Is the Service Unit needed? If yes can I follow some other tutorial to
> get it done? I tried to follow the steps from other tutorials, but not sure
> if I omitted something. In the Hello-World-BC tutorial there is just this:
>
> == 1. Creating a Hello World BC Service Unit 
> This is a work in progress 
>
> 2. What are the steps to deploy the BC into the actual ServiceMix? Same
> problem with the documentation:
>
> == Deploying the Component 
> Now that the SA is built, we're ready to deploy it to the JBI container. 
>
> This is a work in progress. I will finish this up very soon
>
> I tried to reason things out and got to a point where I finally got
> ServiceMix to load my hello-world-sa (created the missing MyBootstrap.java
> etc.) However I must have missed something.
>
> I modified the MySpringComponentTest to use the RemoteServiceMixClient
> instead to access the ServiceMix JVM:
>
> RemoteServiceMixClient rc = new 
> RemoteServiceMixClient("tcp://localhost:61616");
>
>  but I just got this error:
>
> 4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker  - ServiceName
> ({urn:test}service) specified for routing, but can't find it registered
>
>
> I suspect that this is something related to endpoints and the way the BC was
> deployed, but I have no idea what to do next.
>
> In the end I just want to learn how to develop my own BC for a specific
> protocol and have it accessible on the [ServiceMix] ESB from other clients
> remotely.
>
> Thanks.
>
>
>
>
>
>
>