I have a webscript for which i don't want multiple calls at same time. If i get multiple calls at same time, i want to execute the webscript one after the other. Can we do that? If yes please explain the process.
Thanks in advance!
Use the requiresnew in your webscript definition at first.
This will make sure that every call is in it's own transaction and you won't get issues with rollingback etc.
In most cases this will solve all the issues you'll have.
If not then you're probably fixing the problem at the wrong side and you'll need a queue before Alfresco like ActiveMQ.
You can call a method with the synchronize annotation in the webscript's executeImp
Related
I am trying to add basic read/write authorization in gremlin-server, I want to know if there is a way by which I can identify if this query is read-only query or write query.
There is no API call you can make to determine that, but you can get inspiration for how to detect it from ReadOnlyStrategy here. The key is to cycle the Traversal object and look for a Step that implements the Mutating interface. If you find one of those in there, you could classify the traversal as a write query.
Of course, for Gremlin, classifying a query and read or write isn't so binary as it could easily be a mix of read and write. It's also possible that at runtime the write might never execute depending on the flow of the traversal, so it could be "runtime readonly". Hopefully, detecting the Mutating interface is a good-enough solution for you.
I'm not sure where you intend to implement this authorization function but I sense it would be best done as a TraversalStrategy that would then fire on traversal execution. I don't know if that's too late for your authorization process, but it would be the easiest way I can envision. The problem is that if you are accepting scripts then with that approach you could get a partial execution of that script up to the point where authorization was not allowed. If you needed to disallow an entire script based on one write traversal then you might need to look at a custom sandbox. Of course, it is better to avoid scripts altogether and simply use bytecode based requests only. If you are only concerned with bytecode then TraversalStrategy should work pretty well for the authorization use case.
I was hoping to ask for some clarification on the roles of the ChunkedWriteHandler and the HttpObjectAggregator. Do these two effectively do opposite things?
In the following setup:
p.addLast("client_codec", new HttpClientCodec());
p.addLast("chunker", new ChunkedWriteHandler());
p.addLast(new ClientHandler());
Does having the chunker actually do anything? Since I don't have an HttpObjectAggregator in the pipeline, isn't the data going to by written downstream in chunks anyways? When would I need to use a ChunkedWriteHandler for an HTTP server/client?
Thank you!
Please read the javadocs on the classes... ChunkedWriteHandler has nothing to do with HTTP at all. It allows to write implementations of ChunkedInput in an "efficient" manner while HttpObjectAggregator ensures you only see FullHttp* in the handler after it.
im developing dialplan using asterisk and PAGI (PHP asterisk gateway interface)
but i cant find a way to create node which can have dynamic number of annoucements depends on result from database.
I found a way to do this by adding annoucements in loop in method called executeAfterRun
but when Im trying to interrupt node by pressing anything it interrupts only current annoucement and going to playing next one.
I want this whole node to be interruptable not just current annoucement.
can anyone help me with this problem ?
thanks in advance for any help
best regards
You have create in your php code string like
announce1&announce2&announce3
using loop. After that you can use that string for Playback command, it will work like one large file.
First thing is that I am new at Asterisk, and I want to know about calling. I am making Java-Asterisk application. So, I just need direction that how will I be able to know that which caller is calling which one?
You can use asterisk AMI event interface and parse event. That is hard way
Simple way - orginize dialplan so it inform you when someone call someone(by put record in db or any other method).
I have seen several projects that use the Trace functionality to capture events and stream them out to a log file. I have been unsuccessful in finding a simple to follow guide that will show me how to configure Trace to capture and write said logfile. Does anyone have a link recommendations, or provide some simple steps to follow?
The Trace object writes the statements to any attached TraceListeners. You can build your own, but there are a number already defined in the System.Diagnostics namespace, including:
ConsoleTraceListener (Console)
DefaultTraceListener (Visual Studio / Debugger)
DelimitedListTraceListener (TextWriter, special formatting)
EventLogTraceListener (EventLog - anything that inherits from System.Diagnostics.EventLog)
TextWriterTraceListener (TextWriter - think file)
You can, of course, inherit your own from the TraceListener class that writes to where ever you want. For example, you could log to a database, have it send e-mails or pages in certain situations, or write the statements back to a logging platform like log4net.
The big thing is that you need to create an instance of whatever listeners you want and then add them to the Trace' class Listeners collection. You can add as many as you need and Trace will write to all of them. This way, you can write your logging code once using a well-supported and understood object that's part of the framework, and you can attach anything you need to it.
I stumbled into a MSDN article that really helps. Sorry I didn't find it before posting the question but perhaps others may have the same question and haven't found this link.
Take a look at logging frameworks. We rolled out own, but are now migrating over to log4net available free at http://logging.apache.org/log4net/
Im looking for a way to set the Category of the EventLog, the FormattedEventLogTraceListener writes into (not the category of the message).
But I can't find an appropriate property of this class.
Is it possible to set this?