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.
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
.