1

I would like to connect from JBoss AS 6 to Apple Push Notification server using socket.

My problem is that Apple recommends to use the same socket for sending messages (or a pool of sockets). It prevents the DDOS like thing when I send too much messages and blocking my ip address.

My solution: The socket will be opened from singleton bean[SB] and saved in HashMap for further usage. I am going to use stateless bean to send messages by getting the socket from [SB].

I just wanted to ask maybe there is a build-in solution for caching/pooling sockets opened to connect to the clients in JBoss AS 6.

Thank you in advance!

Andy
  • 953
  • 1
  • 8
  • 18

1 Answers1

0

Yes the standard way is to use the Java Connector Architecture (JCA), like how database connections are defined to have connection pools in Java EE servers.

There is an example of an Inbound JCA for Sockets here: https://code.google.com/p/jca-sockets/

But you need to use an Outbound JCA there are examples listed here: JCA sample implementations

You can use http://www.arquillian.org and http://ironjacamar.org for unit testing with an in memory or external Java EE server. The IronJacamar project is the JBoss implementation of JCA.

I have created a JCA 1.5 compliant Resource Adapter targeting IBM Websphere using the above.

Community
  • 1
  • 1
ozOli
  • 1,414
  • 1
  • 18
  • 26
  • ozOli, Thank you very much! Are you sure about JCA? I am interested in connecting to the socket server It means I am a client (the whole EE app is client). AFAIK, JCA is used for creating socket server in Java EE world. Am I wrong? – Andy Feb 03 '15 at 17:49
  • Andy, yes the example I showed is the reverse of what you want. A Resource Adapter can be used to connect to any Enterprise Information System you want. There are examples for files and even a SAP Resource Adapter. You will need to write your own. The IronJacamer and maybe even your IDE will help you create a skeleton implementation of the classes you will need to implement. https://help.sap.com/saphelp_nwpi71/helpdata/en/6f/1bd5caa85b11d6b28500508b5d5211/content.htm – ozOli Feb 04 '15 at 12:20