Re: [ACFUG Discuss] RE: Sync'ing systems via web services

2011-03-28 Thread Douglas Knudsen
Sounding good. If I'm following you correctly, I suggest you use a facade to
expose the API, have your processForeignOrder() method in there and exposed
as a 'web service'.  This method can decide which gateway instance to call
via a Factory.  Each Gateway you have will follow a contract on methods it
has using a interface, something like ICRMGateway.  Thus your Factory has no
clue of your implementation, it just returns a ICRMGateway and your
processForeignOrder()
calls methods on it without caring which Gateway it is.  Sounds like you
will need a property in OrderObject specifying which foreign system was
used, pass this property to your factory method so it can determine which
implementation to return.

Note that ONLY your facade CFC will have remotely exposed methods, all other
CFCs will not.

Make some sense?  This is following the factory pattern here
http://en.wikipedia.org/wiki/Factory_method_pattern.

Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?


On Sat, Mar 26, 2011 at 5:41 PM, Clarke Bishop cbis...@resultantsys.comwrote:

 I’m still working through this project, but I’ve made a lot of progress and
 though I’d give you an update. It might help someone else!



 First, here are some good resources I found on Object-Oriented Coldfusion.
 The first link was especially helpful.


 http://www.iknowkungfoo.com/blog/index.cfm/2007/8/22/Object-Oriented-Coldfusion--1--Intro-to-Objectcfc



 http://www.objectorientedcoldfusion.org/


 http://www.bennadel.com/blog/1379-Hal-Helms-On-Object-Oriented-Programming-Day-One.htm



 Now, here’s where I decided to go:

 · I’ve got a shoppingCartGateway that retrieves all the needed
 data from the shopping cart system.

 · shoppingCartGateway then creates and returns an OrderObject
 populated with all the shopping cart data.

 · I pass the OrderObject into the CRMGateway that stores
 everything in the CRM system.



 The OrderObject is just a value object, but it’s format is consistent, so I
 can switch out either of the gateways.



 I’m still working through how to best apply the business rules. I think
 I’ll cfinclude them into the CRMGateway. It’s just a bunch of If/Then logic.



 I’m sure I broke some OO rules along the way, but my new approach feels
 cleaner and more workable. Of course, I’m still open to suggestions if
 anyone knows a better way!



Clarke



 *From:* Clarke Bishop [mailto:cbis...@resultantsys.com]
 *Sent:* Wednesday, March 23, 2011 12:50 PM
 *To:* discussion@acfug.org
 *Subject:* Sync'ing systems via web services



 I have a project to sync two systems via web services. The objective is to
 get customer data and orders from a shopping cart, and then transfer the
 data into a CRM system. It's a one-way transfer now.

 There will be different shopping carts systems, different CRM's, different
 business rules for different companies, and sometimes slightly different
 data elements. For example:

 Company A might use Magento shopping cart with CRM A.
 Company B might use Volusion shopping cart with CRM A.
 Company C might use Magento shopping cart with CRM B.

 To sync the data, this is what needs to happen:

1. Periodically, check the shopping cart for any new orders.
2. For any new order get additional information out of the shopping
cart (Some data isn't available via the order API call)
3. Create or update the info in the CRM.
4. Run a set of business rules based on the order and set fields or
flags in the CRM.

 I'm trying to create the right abstractions that make this manageable. I
 have a procedural version, but I want to divide up the code to make it
 easier to manage and enhance. Right now, I have to copy the code and make a
 version for each Company -- Messy!

 I was thinking I could have a shoppingCartGateway.cfc and a CRMGateway.cfc
 to manage CRUD for each shopping cart and CRM. I'm hoping to be able to
 switch out the shopping cart gateway to handle different shopping carts, and
 then have a one, consistent order object or structure.  Then, I can sync the
 order object with any CRM via the CRM gateway. I'd like to decouple the CRM
 from the shopping cart to handle all the variations.

 I'd need an orderObject.cfc to hold all the order and customer data. Or,
 this could possibly just be a big Struct, or I could store the order data in
 a database. I expect, it will take several gateway calls to fully set all
 the data values in the orderObject, so I need a way to keep the data around
 and get it organized.

 My question is what's the best design architecture? I'm writing this to
 clarify my thinking and I'm also hoping some of you will have some good
 ideas or pointers for me!

 I'm having trouble thinking about which object should be responsible for
 what!

- Does the orderObject create and use the shoppingCartGateway.cfc as a
service to initialize itself?
- Or, do I have a separate sync.cfc that just uses the orderObject as a
value 

RE: [ACFUG Discuss] Weird CF 9 behaviour tied to DB/DSN (DB is read only)

2011-03-28 Thread Charlie Arehart
Well, Ajas, while you can't get it from the Multiserver monitor, no, you CAN
get it from the Server Monitor. The former offers only a subset of the
latter, with the goal of offering that subset in one interface across
multiple servers. In other words, I was saying that you CAN get a stack
trace in the CF Server Monitor, either by enabling profiling, or by using
the Snapshot feature. But of course FusionReactor will help as well, of
course.

 

/charlie

 

From: ad...@acfug.org [mailto:ad...@acfug.org] On Behalf Of Ajas Mohammed
Sent: Saturday, March 26, 2011 5:51 PM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] Weird CF 9 behaviour tied to DB/DSN (DB is read
only)

 

Thanks Charlie. So looks like I cant get what I was looking for using
MultiServer Monitor.

I will have to install FR on this Test Server to see what is going on.

I will let you know what I find out.

Ajas Mohammed /

On Fri, Mar 25, 2011 at 4:54 PM, Charlie Arehart char...@carehart.org
wrote:

Hey Ajas, yes, I only mentioned FR because I knew you used it on at least
some servers. Yes, you can get the same stack trace with the Server Monitor
(though not the Multiserver Monitor, as that presents only a subset of the
former, albeit as viewed across several servers/instances at once.)

Even then, though, be aware that you need to enable start monitoring and
start profiling in the CF Server Monitor to see the stack trace for any
running request (it appears in the middle of the detail page when you
double-click a running request.) You can also see it using the snapshot
feature, though that instead is a thread dump of all running threads, not
just the one of interest, so takes a little more effort to work through.

As for the spinning page being the Admin, again, that doesn't really matter.
Yes, it's just a cfm request so it can be monitored using these tools. That
said, another benefit of FR is that it will show you CF Admin pages by
default, but the CF Server Monitor intentionally hides them, so you need to
go into the settings for the monitor and tell it to show the Admin pages.

/charlie 

 




-
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-



Re: [ACFUG Discuss] cfloop query - whats best include page vs cfhttp

2011-03-28 Thread Ajas Mohammed
Wow, thanks for that tip Charlie. I completely missed it. I am so mad at
myself that I did not think about it because object creation is one of the
heavy duty stuff CF has to do. :-(

http://www.objectorientedcoldfusion.org/wiki/Creating_Objects

So now logic has become this with instantiation outside cfloop query

cfset myobj= createObject(component,someCFC)

cfloop query

!--- Call fnRPDF function on myobj object---
cfset myobj.fnRPDF()

/cfloop

Thanks all.

Ajas Mohammed /
http://ajashadi.blogspot.com
We cannot become what we need to be, remaining what we are.
No matter what, find a way. Because thats what winners do.
You can't improve what you don't measure.
Quality is never an accident; it is always the result of high intention,
sincere effort, intelligent direction and skillful execution; it represents
the wise choice of many alternatives.


On Sat, Mar 26, 2011 at 12:34 PM, Charlie Arehart char...@carehart.orgwrote:

 Ajas, from a performance perspective, you may want to create an instance of
 the CFC outside the loop and then only call the desired method within it.



 /charlie



 *From:* ad...@acfug.org [mailto:ad...@acfug.org] *On Behalf Of *Ajas
 Mohammed
 *Sent:* Friday, March 25, 2011 11:29 PM
 *To:* discussion@acfug.org
 *Subject:* Re: [ACFUG Discuss] cfloop query - whats best include page vs
 cfhttp



 Thanks all.



 here is how I am using it now



 Pseudo code:

 cfloop ...

 cfinvoke component=something method=createpdf instead of cfset
 myUDForCFC.createDoc(argumentCollection=...) /

 /cfloop



 Teddy, that should work the way you mentioned right, i.e. the processing of
 one document will complete and cfloop with go to next
 record returned by query and so on. I am just hoping the variables etc dont
 get messed up between calls but I am thinking I should be fine because I am
 the only one calling this page.




 Ajas Mohammed /



 -
 To unsubscribe from this list, manage your profile @
 http://www.acfug.org?fa=login.edituserform

 For more info, see http://www.acfug.org/mailinglists
 Archive @ http://www.mail-archive.com/discussion%40acfug.org/
 List hosted by FusionLink http://www.fusionlink.com
 -