Accessing FAM_Space in a Spring Bean
Posted: Wed, 09/24/2008 - 15:50
Accessing FAM_Space in a Spring Bean
Hi All,
Just trying to get my head around the different ways to deal with Spring. I've done the tutorials for Spring and they work great. Now, I would like to figure out a way to access the Fabric from my Spring bean. Specifically, I want to create a FAM_Space and queue so that I can exchange data among processes.
Typically, the spring beans loaded into the fabric, don't know about the fabric. Should I pass in the fabric that is created in the Spring startup modules? If I have a pointer to the fabric, how do I get the session context to create the FAM_Space.
Any thoughts would be helpful.
Thanks,
Tom








So, I guess, specifically, in order to read or write to the FAM, I need the famSession.
I can get the FAM, but I can't find a way to get the famSession from it.
Thanks,
Tom
Hi Tom,
Are you using Spring on both the client and the fabric? Specifically, are you using a FabricProxyFactoryBean on the client side to create beans that communicate with the fabric?
Thanks,
Randy
Hi Randy,
Thanks for the response.
I am actually trying to extend the spring_hello_world_* samples from the website. But, specifically, it does use the FabricProxyFactoryBean in order to get to the spring bean in the fabric.
It would be really great to have some additional docs for Spring.
Thanks.
Tom
Tom,
In the current 3.9 release the way you will need to obtain a session is through the FAM_Session.createFabricExternalSession(String lockId, String version) static factory method. Unfortunately creating a session this way is complicated and problematic when errors occur so we don't recommend it, but, it should get you going if you're just prototyping. You'll need to populate the lockId with a GUID. The version can just be "1" - its purpose is difficult to explain.
We are currently working on creating a better way of dealing with FAM sessions in the Java api. We'll have a pre-beta build in the next few days so if you'd like to try it out I can send it to you.
Thanks,
Randy
Thanks for the response.
I am actually trying to extend the spring_hello_world_* samples from the website. But, specifically, it does use the FabricProxyFactoryBean in order to get to the spring bean in the fabric.
It would be really great to have some additional docs for Spring.
Thanks.
Tom
Hi Tom,
I know Randy's working through this question with you. I just wanted to jump in and ask about the docs. We're always looking to improve them, and know we still have work to do. Do you have some specific things that tripped you up, or that was missing or incorrect?
Much appreciated,
Guerry
Hi Guerry,
Thanks for the inquiry.
I know that I learn from example, as do many other developers. Unfortunately, given that Appistry is an infrastructure product, its difficult to create a wide enough example set that will cover all of possible uses for the product; however, creating and carrying through a theme a little further, I think, will go a long way to demonstrating how one uses the fabric. i.e. Do all examples for all technologies (which is partially done).
For example:
1) Simple calling of methods - Like hello world, which is already done
2) Calling the fabric API from a deployed bean - Done for a POJO, but not Spring
3) Creating FAM spaces or queues - Done for a POJO, but not Spring
etc.
Given that the Spring Framework is a very popular framework for Java, more Spring-specific examples and/or documentation would be helpful. There are two example sets. Hello world, which is separate from the installed fabric, and the tutorials which get installed. Just a suggestion, but I think it would be easier to consolidate them. Then, for each example and tutorial, do it for each of the technologies.
The API documentation is also lacking in description of the actual uses for the API and the methods.
I think that the Appistry platform is great and serves to solve many of the problems we all face when deploying reliable and scalable solutions. I might recommend that, in order to save developer time, it would be good to see best practices for development environments of choice. i.e. Spring, Java, .Net, etc. Maybe a forun on best practices. But since Appistry built and supports the product, they're in the best position to publish some best practices for implementation.
Any hints on security? I know the topic is broad and maybe not an issue for the fabric, but we're always asked to deal with security, and there really isn't any information on that topic.
I hope this helps.
I'll continue to provide feedback since I think this is an important technology for us to embrace and keep alive.
Tom
Hi Randy,
Thanks, we'll try this work around. Yes, we'd be interested and willing to work with the beta and provide feedback.
Tom