[JBoss Messaging] - Re: subscription & client id: does not allow dots
by sergeypk
I have trouble coming up with a failing test for this. This is what I tried (and it passed):
| public void testDurableSubscriptionWithPeriodsInName() throws Exception
| {
| ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory");
| Topic topic = (Topic)ic.lookup("/topic/Topic");
|
| Connection conn = cf.createConnection();
| conn.setClientID(".client.id.with.periods.");
|
| Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
| TopicSubscriber subscriber = s.createDurableSubscriber(topic, ".subscription.name.with.periods.");
|
| s.createProducer(topic).send(s.createTextMessage("Subscription test"));
|
| conn.start();
|
| Message m = subscriber.receive(1000L);
|
| assertNotNull(m);
| assertTrue(m instanceof TextMessage);
|
| subscriber.close();
|
| s.unsubscribe(".subscription.name.with.periods.");
|
| conn.close();
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059880#4059880
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059880
18Â years, 9Â months
[JBoss Seam] - Re: ResourceBundle in Database
by Zerg-Spirit
Thanks, it helped me a lot!
Now, I kinda understood how it's working, but my very last problem is pretty tough: I can't retrieve the EntityManager in my Session Bean extending ResourceBundle.
@Stateless
| @Scope(SESSION)
| @Name("dbResourceBundle")
| public class DBResourceBundle extends ResourceBundle implements iDBResourceBundle{
|
| @PersistenceContext
| private EntityManager em;
|
| private List<CustomResourceBundle> availableResourceBundles;
|
| public DBResourceBundle(){
| System.out.println("EntityManager: "+em); //em is null :/
| try{
| availableResourceBundles = em.createQuery("select rb from CustomResourceBundle rb").getResultList();
| }
| catch(Exception e){
| //null pointer exception cause em is null.
| e.printStackTrace();
|
| }
| }
| ...
|
CustomResourceBundle being an entity bean representing a 'bundle' for the given language.
How to retrieve a workable EntityManager?
My guess is that when this Session Bean is instanciated, the PersistenceContext isn't created yet.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059868#4059868
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059868
18Â years, 9Â months