0

I have an MDB that I cannot modify, it is declared with annotations, not within xml file.

Can I somehow override it's implementation, specifically onMessage behaviour?

I tried modyfing xml files to point MDB to different class or just simply extend original MDB class and override OnMessage method, but in logs I can see that it is always old MDB being registered and receivng all messages.

EyeMaze
  • 143
  • 2
  • 9

1 Answers1

1

You should be able to override bean class annotations with ejb-jar.xml descriptor. That's one of the main reasons to have xml descriptors.

To go one step further, you can even completely ignore annotations with ejb-jar.xml that sets metadata-complete=true.

cheng
  • 1,076
  • 6
  • 6
  • @chenq Seems like a good direction. I've managed to override bean class annotations with ejb-jar.xml, but only when bean is in the same .jar file. In my case original bean in in a.jar, while I need to override it inside c.jar, where a.jar is an dependency of c.jar. Right now it creates two MDB's with exactly the same name. – EyeMaze Jul 08 '20 at 13:10
  • Then you can just modify the `ejb-jar.xml` in the jar containing the problematic MDB, and update the target archive, say with `jar uvf`. If the original MDB ejb jar does not have `ejb-jar.xml`, just add one there. If that still does not work for you, check out WildFly deployment [overlay](https://docs.wildfly.org/20/Admin_Guide.html#Deployment_Overlays). – cheng Jul 09 '20 at 14:31