In an orchestration I notice that if I right-click in a construct message shape and select "Insert Shape" then three options are enabled:
Transform
Message Assignment
Call Rules
I would like to use the Call Rules option, have the rule populate a newly constructed message. Unfortunately, when I select this, I get the message "A Construct statement can only contain Message Assignment and Transform shapes".
Does anyone know if it possible to have a message populated in a BRE rule?
It seems the construct shape isn’t required. I guess a copy of the message that’s passed into the rule gets created implicitly.
Related
I am trying to use Serilog in my .Net Core API to log to SQL Server with the Serilog-Sinks-MSSqlServer sink. The standard Level column either writes out the full value (e.g. Information, Warning, Error) or a TinyInt enum value if you set the StoreAsEnum property to true as shown here. I cannot seem to find an easy way (like there is in Log4net and NLog) to format the output to write only the first character of the Level (e.g. I, W, E). I tried setting the DataLength property to 1 but that causes the log entry to not be written at all.
I have been able to accomplish my desired behavior with a custom enricher that takes the Level value from the standard column and then uses just the first character to write to a custom column while removing the standard Level column but that really seems like overkill when I feel like there may be a formatting mechanism somewhere that I just haven’t seen.
For Serilog.Sinks.MSSqlServer, it does not expose easy way to custom the Level value.
If you check MSSqlServerSink, you will see that it convert IEnumerable<LogEvent> events to _traits.eventTable by a private method, which means you could not override the method void FillDataTable(IEnumerable<LogEvent> events).
In addition, for MSSqlServerSinkTraits, it is internal, you could not inherit from it to implement your own MSSqlServerSinkTrait.
There is no much thing you could not if you want to override something from Serilog.Sinks.MSSqlServer.
For easiest way, you may consider forking the Serilog.Sinks.MSSqlServer, and change GetStandardColumnNameAndValue from below code
case StandardColumn.Level:
return new KeyValuePair<string, object>(columnOptions.Level.ColumnName, columnOptions.Level.StoreAsEnum ? (object)logEvent.Level : logEvent.Level.ToString());
to change logEvent.Level.ToString() to your expected value like logEvent.Level.ToString().Substring(0,1).
Then build the project and reference this project instead of Serilog.Sinks.MSSqlServer
I recognized that (insert/delete)-XQueries executed with the BaseX client always returning an empty string. I find this very confusing or unintuitive.
Is there a way to find out if the query was "successful" without querying the database again (and using potentially buggy "transitive" logic like "if I deleted a node, there must be 'oldNodeCount-1' nodes in the XML")?
XQuery Update statements do not return anything -- that's how they are defined. But you're not the only one who does not like those restrictions, and BaseX added two ways around this limitation:
Returning Results
By default, it is not possible to mix different types of expressions
in a query result. The outermost expression of a query must either be
a collection of updating or non-updating expressions. But there are
two ways out:
The BaseX-specific update:output() function bridges this gap: it caches the results of its arguments at runtime and returns them after
all updates have been processed. The following example performs an
update and returns a success message:
update:output("Update successful."), insert node <c/> into doc('factbook')/mondial
With the MIXUPDATES option, all updating constraints will be turned off. Returned nodes will be copied before they are modified by
updating expressions. An error is raised if items are returned within
a transform expression.
If you want to modify nodes in main memory, you can use the transform
expression.
The transform expression will not help you, as you seem to modify the data on disk. Enabling MIXUPDATES allows you to both update the document and return something at the same time, for example running something like
let $node := <c/>
return ($node, insert node $node into doc('factbook')/mondial)
MIXUPDATES allows you to return something which can be further processed. Results are copied before being returned, if you run multiple updates operations and do not get the expected results, make sure you got the concept of the pending update list.
The db:output() function intentionally breaks its interface contract: it is defined to be an updating function (not having any output), but at the same time it prints some information to the query info. You cannot further process these results, but the output can help you debugging some issues.
Pending Update List
Both ways, you will not be able to have an immediate result from the update, you have to add something on your own -- and be aware updates are not visible until the pending update list is applied, ie. after the query finished.
Compatibility
Obviously, these options are BaseX-specific. If you strongly require compatible and standard XQuery, you cannot use these expressions.
I am doing WTX transformation in datapower in probe i can see output is generated properly, but when I check the output in the target queue it is populating with the input request and the WTX transformed output. can i get some cause why it may come like this?
make sure you have some action that takes INPUT as its input context before your WTX binary transform. Otherwise it gets passed along to the backend.
I normally set the WTX Transform as explicit and then have the INPUT as Input to the Action and explicitly set the "real" Inputs to the context of the Input-card(s) on the map.
I have a BizTalk orchestration with an expression. The expression has the following:
construct msg_mymessage { msg_mymessage = msgInputXML; }
msgInputXML and msg_mymessage use the same schema, same message type and both show up under the Messages in Orchestration view.
After the expression I have a Construct Message and in the Construct message I have a Transform that uses msg_mymessage as a source and some other message as a destination.
I'm getting the errors:
use of unconstructed message 'msg_mymessage'
'msg_mymessage':message has not been initialized in construct statement
I'm not sure why I get this error. What should I be looking for?
Make sure that you use an assignment shape (inside a construct message wrapper) when you create msg_mymessage. Then just copy the code in the expression shape (msg_mymessage = msgInputXML;)
http://msdn.microsoft.com/en-us/library/ee253499(v=bts.10).aspx
Do you need to do,
msg_mymessage = new System.Xml.XmlDocument();
My guess is that you didn't construct msg_mymessage in earlier shapes.
Check the blog article Constructing BizTalk 2004 XML Messages (In an Orchestration) - Choices which demonstrates several ways to construct a message in BizTalk .
In your constructed messages shape, you need to define the message type you are going to create. when you drop the shape, the drop down dialog will ask you what type of message you are constructing. You can select more than one. so if you happen to have a message checked that isnt being constructed in this shape, you will get this exact message also.
I'm trying to understand when I should call Query.close(Object) or Query.closeAll();
From the docs I see that it will "close a query result" and "release all resources associated with it," but what does "close" mean? Does it mean I can't use objects that I get out of a Query after I've called close on them?
I ask because I'm trying to compartmentalize my code with functions like getUser(id), which will create a Query, fetch the User, and destroy the query. If I have to keep the Query around just to access the User, then I can't really do that compartmentalization.
What happens if I don't call close on an object? Will it get collected as garbage? Will I be able to access that object later?
Please let me know if I can further specify my question somehow.
You can't use the query results since you closed them (i.e the List object you got back from query.execute). You can access the objects in the results ... if you copied them to your own List, or made references to them in your code. Failure to call close can leak memory
When your query method returns a single object it is easy to simply close the query before returning the single object.
On the other hand, when your query method returns a collection the query method itself can not close the query before returning the result because the query needs to stay open while the caller is iterating through the results.
This puts the responsibility for closing a query that returns a collection on the caller and can introduce leaks if the caller neglects to close the query - I thought there must be a safer way and there is!
Guido, a long time DataNucleus user, created a 'auto closing' collection facade that wraps the collection returned by JDO's Query.execute method. Usage is extremely simple: Wrap the query result inside an instance of the auto closing collection object:
Instead of returning the Query result set like this:
return q.execute();
simply return an 'auto closing' wrapped version of it:
return new JDOQueryResultCollection(q, q.execute());
To the caller it appears like any other Collection but the wrapper keeps a reference to the query that created the collection result and auto closes it when the wrapper is disposed of by the GC.
Guido kindly gave us permission to include his clever auto closing code in our open source exPOJO library. The auto closing classes are completely independent of exPOJO and can be used in isolation. The classes of interest are in the expojo_jdo*.jar file that can be downloaded from:
http://www.expojo.com/
JDOQueryResultCollection is the only class used directly but it does have a few supporting classes.
Simply add the jar to your project and import com.sas.framework.expojo.jdo.JDOQueryResultCollection into any Java file that includes query methods that return results as a collection.
Alternatively you can extract the source files from the jar and include them in your project: They are:
JDOQueryResultCollection.java
Disposable.java
AutoCloseQueryIterator.java
ReadonlyIterator.java