Rebus Azure topic names cleanup - rebus

Working with AzureServiceBus, and using the ITopicnameConvention and for some reason my topic names have some "cleanup" after the GetTopic() method.
They all end up in lowercase and '.' are replaced with '_'
Am I missing something? I'm using the namespace and other combination of things to create topic names and I want them to be something like
MyDomain.Events
and I'm getting
mydomain_events
How can I achieve this?

Related

Flyway fails in recognizing correct placeholder "${"

I have recently been trying to upgrade flyway from v4 to v6.5.3. During the process, I faced an issue related to placeholders.
The migration fails with the following error.
ERROR: Unable to parse statement in
D:\Softwares\flyway-commandline-6.5.5-windows-x64\flyway-6.5.5\sql\V3__mysql-7.0.sql
at line 101 col 1. See
https://flywaydb.org/documentation/knownparserlimitations for more
information: No value provided for placeholder: ${'), NOW(), NOW())}.
Check your configuration! Caused by: No value provided for
placeholder: ${'), NOW(), NOW())}. Check your configuration!
SQL,
insert into `configuration`(key, value, created_date , updated_date) values('LOG_LOCATION', REPLACE('${MY_LOG_LOCATION}','#{','${'), NOW(), NOW());
To resolve the above failure, I replaced "${" with "$\{", but this is something I didn't look out for.
On debugging the flyway code, I saw it fails in parsing (during validation, method org.flywaydb.core.internal.parser.Parser.readToken()) of the SQL.
Why is it considering the 3rd argument of REPLACE function as a placeholder?
Note: The above SQL works in Flyway v4
If you read the documentation here, you can see that flyway uses a particular syntax for it's placeholders, ${somestring}. In your code, you have a ${, but it's not defining a placeholder. While Flyway is a pretty sophisticated tool, the mechanism here is simply using string matching. If you want to, you can modify your Flyway instance to use different escape characters for the placeholders. This could be handy if you have to have strings in your code that match that ${ syntax. You can read about that here. Scroll down to where you define the PlaceHolderPrefix and PlaceHolderSuffix. Change those to a different combination of values that are not used in your code and you should be fine.

How to dynamically search/replace text with update in XQuery (exist-db)

My intention is to somehow clean source files automatically. How to do that in XQuery? (I am not interested in reconstructing the document in memory and storing it as a new one.) It is quite easy to do something similar in case of short and simple elements addressed directly, however, I can’t figure out how to do that dynamically for all the text nodes, if possible.
I would expect something like this could work:
update replace $div[contains(., 'chapter')] with replace(., 'chapter', 'Chapter')
This throws err:XPDY0002 Undefined context sequence for 'self::node()' [source: String]
Apparently, there is a problem in addressing the context with . in the replacing function. But maybe I don’t understand the update thing in general. I am only inspired by the bottom of this article.
Expression to the right of with is independent from expression to the left. So an explicit node/context is needed on both part :
update replace $div[contains(., 'chapter')] with replace($div, 'chapter', 'Chapter')

XQuery function or library for iso country codes?

In Oracle Service Bus I need 'ISO 3166-1 alpha-2' and 'ISO 3166-1 alpha-3' country codes.
At the moment I'm using Java Callout to get the same (which I would like to avoid).
I'm new to both these technologies and unaware of the standard practices so just wanted to check your opinion.
1. I was just wondering if there are any XQuery libraries which could provide country codes.
2. Considering most probably these values are going to be constant, is it okay to handwrite the function.
Thanks.
I don't know of an existing XQuery module that provides that functionality. But as all codes are available from the ISO Online Browsing Platform, you cal easily build your own.
I quickly generated an XML document from all currently assigned codes, which can be found at https://gist.github.com/LeoWoerteler/9388743. Using that, the conversion from alpha-2 to alpha-3 codes could be done as follows:
declare variable $iso_3166-1 := doc('iso_3166-1.xml')/iso_3166-1;
declare function local:alpha2-to-alpha3($code) as xs:string {
$iso_3166-1/country[#alpha-2 = $code]/#alpha-3
};
local:alpha2-to-alpha3('US') (: ==> 'USA' :)
You could use the ISO 2 letter country codes from here: http://www.codesynthesis.com/projects/xsstl/xsstl/iso3166-country-code.xsd
With that document you could lookup countries by their country code using something like the following:
declare namespace xsd = "http://www.w3.org/2001/XMLSchema";
replace(//xsd:enumeration[#value eq 'BV']/following-sibling::comment()[1], "<!-- (.*) -->", "$1")
Personally I would transform that Schema document into a simple XML document, extracting the country names from the comments so that I do not have to query the comments themselves.

Using XQuery with multiple collection functions

I am using the following XQuery to query a collection of files:
for $files in collection("/data?select=*data*.xml")
Each file in the directory has a specific name, which enables me to recognize it. I use this as the identifier, which I retrieve as follows:
let $file-id := tokenize(base-uri($files), "/")[last()]
The $file-id variable follows a certain pattern: abc-1234. The first eight characters are relevant, so I fetch them using the variable below:
let $file-link-id := substring($file-id, 1, 8)
Now, I have another collection of files, which I want to query. These files follow the same pattern in the name, because they contain connected information.
How can I use the $file-link-id to select the correct file in the second collection?
I assume I would have to include it in the second collection clause, something along the lines of ?select=$file-link-id.xml, but I am unsure of how to do this.
Maybe you could clearify your problem statement if I assume wrong here, because your problem seems to be very easy solveable (so maybe I misunderstood your problem).
So you have your correct $file-link-id and want to use it as string. If your xquery processor supports XQuery 3.0 you can use two pipes, i.e.
for $files in collection("/data?select=" || $file-link-id || ".xml")
If not, use string-join():
for $files in collection(string-join(("/data?select=", $file-link-id, ".xml"), ''))

Google Analytics - Issue multiple commands within same push, correct namespacing

According to GA docs, I can issue multiple commands with a single push, however in their code snippet they do not prefix the first namespace, whereas they prefix the subsequent namespace with the letter "b". I prefer consistency, so I opted to prefix the first namespace actions with the letter "a" like the following:
['a._setAccount', 'UA-MYACCOUNT-1'],
['a._trackPageview'],
['b._setAccount', 'UA-MYACCOUNT-2'],
['b._trackPageview']
Anyone know if there is an issue in doing this? Or should I just follow the google example and remove the "a" prefix "just to be safe"?
The only issue that I'm aware of is that without a default (unnamed) tracker, you have to make sure to use the optional name argument to _getTrackerByName().
If you don't, a new default tracker will be created & returned, which is probably not what you expected.

Resources