• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

printing from MDB

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am working on a JMS project where I need to take a message from a Message driven bean and print the contents to a network printer. Since we cannot use java.io in EJBs I am restricted to write the print file directly from MDB. Can anybody suggest what is the best way to print the message contents from an MDB. Also I am searching for a existing resource adapter to create a flat file from message contents and print to network printer. Any suggestions or ideas are appreciated.
Pardha
SCJP,SCWCD,SCBCD
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can still use java.io -- it's just your MDB "may not be portable". The line in the spec is a warning, not a full restriction. I'd go ahead and write it the way you want to with java.io.
Kyle
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A few warnings from experience: the javax.print stuff is not really designed for networked apps. We had problems with locating printers - you can't (for example) just give the PrintService an IP address or UNC path. Also the print service build its Printable objects up as Graphics - and so these can get unexpectedly big quite quickly, slowing down your app server. Formatting text can be tedious too. In the end we dropped the stuff to be printed onto the file system, and had a daemon process listening for new docs handle the printing (we have an MS environment, so this was just a quick WSF). This quite a bit easier, as well as more performant.
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could always create a JMS client that is deployed as an application-client to your EJB jar and run wherever your printer is. That way it can receive message from the same topic/queue, but won't slow down your application server. Oh, and you won't have any "warning" issues as far as using IO in your EJBs.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic