I did resolved my issue, it was a rooky mistake as I'm new over osgi and
had no experience working with threading.
Right now it's ok for me I resolved the issue.
If I could help lemme know.


2017-02-24 9:44 GMT+01:00 Mestiri Meher <meher.mest...@gmail.com>:

> I don't know if you received or not the bundles, I'll try again:
>
> 2017-02-24 9:43 GMT+01:00 Mestiri Meher <meher.mest...@gmail.com>:
>
>> Hey here are my bundles :)
>>
>> Just rename'em into .zip
>>
>> 2017-02-24 9:19 GMT+01:00 Randy Leonard <randy.leonard....@gmail.com>:
>>
>>> First, a comment:
>>>  - Your issue is with the consumer, but you have provided code for the
>>> producer ;)
>>>
>>> You will see on the subsequent post I am also having an issue with
>>> Apache MQ.  Some questions:
>>>  - Are you using 'activemq-all-5.14.3', or 'activemq-osgi-5.14.3’
>>>  - If you wish to zip up your project for me… I’ll send back a working
>>> example for you
>>>
>>> Thanks,
>>> Randy
>>>
>>>
>>> On Feb 23, 2017, at 3:55 PM, Mestiri Meher <meher.mest...@gmail.com>
>>> wrote:
>>>
>>> Hello guys,
>>>
>>> I was able to bundle the ActiveMQ and push it into the Apache Felix
>>> context but I faced an issue when I started playing with it:
>>>
>>> Here is the scenario :
>>> 1/ I created the ActiveMQ bundle inside apache felix, I run it and it
>>> listens to the needed port. 2/ I created the producer bundle and putted
>>> all the needed connection and queue creation in the start method. 3/ I
>>> created the consumer bundle following the same strategy Once I start
>>> the producer, I can see my message sent. Once I run the consumer it's
>>> ok I can see the message received, the issue is once I stop the
>>> producer bundle and I restart it, I was waiting to get a notification from
>>> my consumer bundle but not, I do have to restart the consumer so it knows
>>> about the new message and throw it out. Do you have an idea on how
>>> could I get notified by my bundle once a new message pushed into the broker
>>> queue ?
>>>
>>>
>>> I'm thinking about the fact that I did not used the multithreading, but
>>> I'm not sure, in the activeMq tutos it creates the producers/consumers
>>> using threads.
>>> So probably that's the issue..
>>>
>>> Do I have to register my bundle in the osgi service registry ?!
>>>
>>>
>>> Here is the code I'm using inside my bundle and start method (it does
>>> not implement runnable or runs this inside a thread):
>>>
>>>  //this is my start method
>>>            // Create a ConnectionFactory
>>>             ActiveMQConnectionFactory connectionFactory = new 
>>> ActiveMQConnectionFactory("vm://localhost");
>>>
>>>             // Create a Connection
>>>             Connection connection = connectionFactory.createConnection();
>>>             connection.start();
>>>
>>>             // Create a Session
>>>             Session session = connection.createSession(false, 
>>> Session.AUTO_ACKNOWLEDGE);
>>>
>>>             // Create the destination (Topic or Queue)
>>>             Destination destination = session.createQueue("TEST.FOO");
>>>
>>>             // Create a MessageProducer from the Session to the Topic or 
>>> Queue
>>>             MessageProducer producer = session.createProducer(destination);
>>>             producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
>>>
>>>             // Create a messages
>>>             String text = "Hello world! From: " + 
>>> Thread.currentThread().getName() + " : " + this.hashCode();
>>>             TextMessage message = session.createTextMessage(text);
>>>
>>>             // Tell the producer to send the message
>>>             System.out.println("Sent message: "+ message.hashCode() + " : " 
>>> + Thread.currentThread().getName());
>>>             producer.send(message);
>>>
>>>             // Clean up
>>>             session.close();
>>>             connection.close();
>>>
>>>
>>>
>>> Thanks all for your help and sharing about osgi!
>>> _______________________________________________
>>> OSGi Developer Mail List
>>> osgi-dev@mail.osgi.org
>>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>>>
>>>
>>>
>>> _______________________________________________
>>> OSGi Developer Mail List
>>> osgi-dev@mail.osgi.org
>>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>>>
>>
>>
>
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to